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

Add suggestions to extra_unused_type_parameters #10536

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

mkrasnitski
Copy link
Contributor

Change the extra_unused_type_parameters lint to provide machine applicable suggestions rather than just help messages. Exception to this are cases when any unused type parameters appear bounded in where clauses - for now I've deemed these cases unfixable and separated them out. Future work might be able to provide suggestions in these cases.

Also, added a test case for the avoid_breaking_exported_api config option.

r? @flip1995

changelog: [extra_unused_type_parameters]: Now provides fixable suggestions.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 23, 2023
@mkrasnitski
Copy link
Contributor Author

Would be great if this could get reviewed (and hopefully merged) before next week's sync.

cc-ing @Jarcho who has helped with review on this lint in the past

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

This looks like it was more work than I anticipated. Thanks for doing this. Making this suggestion auto-applicable is really awesome!

@flip1995
Copy link
Member

@bors r+

Sorry for taking so long.

@bors
Copy link
Collaborator

bors commented Mar 31, 2023

📌 Commit 50d92d0 has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Mar 31, 2023

⌛ Testing commit 50d92d0 with merge 2998706...

@bors
Copy link
Collaborator

bors commented Mar 31, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 2998706 to master...

@bors bors merged commit 2998706 into rust-lang:master Mar 31, 2023
@mkrasnitski
Copy link
Contributor Author

This looks like it was more work than I anticipated. Thanks for doing this. Making this suggestion auto-applicable is really awesome!

I was able to take inspiration from the unnecessary_lifetimes lint, which does something similar. In fact, I was able to provide better suggestions in the case where multiple parameters at the end of the list should be removed (that's what the whole iterating-in-reverse and chain-extension logic is for). It was definitely a fun problem to solve!

Sorry for taking so long.

No worries! Thanks for the review!

@mkrasnitski mkrasnitski deleted the suggestions branch March 31, 2023 17:00
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.

None yet

4 participants