Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assist : generate trait from impl #15152

Merged
merged 5 commits into from Jul 5, 2023
Merged

assist : generate trait from impl #15152

merged 5 commits into from Jul 5, 2023

Conversation

alibektas
Copy link
Member

fixes #14987 . As the name suggests this assist is used to generate traits from inherent impls while adapting the original impl to fit to the newly generated trait. I made some decisions regarding when the assist should be applicable. These are surely open to discussion. I looking forward to any feedback.

generate_trait_from_impl_v1

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 27, 2023
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
@Veykril
Copy link
Member

Veykril commented Jul 3, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 3, 2023

📌 Commit 20c877a has been approved by Veykril

It is now in the queue for this repository.

@lowr
Copy link
Contributor

lowr commented Jul 3, 2023

@bors r-

I've started reviewing but haven't gotten time to finish it. I'm really sorry for the silence and abrupt r- but let me have one more day to review.

@Veykril
Copy link
Member

Veykril commented Jul 3, 2023

No problem, if you want to take "ownership" of a review feel free to assign yourself to such PRs (or do the initial review :^)

Copy link
Contributor

@lowr lowr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat nitpicky, but bear with me 😅

crates/syntax/src/ast/make.rs Outdated Show resolved Hide resolved
@lowr
Copy link
Contributor

lowr commented Jul 4, 2023

Also, I think indent levels break when the impl in question is not a top-level item of the file. Can you add a test for that, something like the one below? You may want to use ast::edit::IndentLevel to fix that.

mod a {
    impl S$0 {
        fn foo() {}
    }
}

@Veykril
Copy link
Member

Veykril commented Jul 4, 2023

Whoops, didn't meant to do that

@lowr
Copy link
Contributor

lowr commented Jul 5, 2023

Nice work, thanks!

@bors r=Veykril,lowr

@bors
Copy link
Collaborator

bors commented Jul 5, 2023

📌 Commit 8edb3e1 has been approved by Veykril,lowr

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 5, 2023

⌛ Testing commit 8edb3e1 with merge aa91eda...

@bors
Copy link
Collaborator

bors commented Jul 5, 2023

☀️ Test successful - checks-actions
Approved by: Veykril,lowr
Pushing aa91eda to master...

@bors bors merged commit aa91eda into rust-lang:master Jul 5, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Generate trait from impl
6 participants