-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
chore: use multipart_suggestions for match_same_arms #13803
chore: use multipart_suggestions for match_same_arms #13803
Conversation
9ac0f8c
to
7d1e0da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! ❤️
I'm wondering if we could also remove the @no-rustfix
from match_same_arms.rs
, now that rust-lang/cargo#14747 is merged. Could you test that? (Different issue, but I figure that it's related enough.)
Hey @blyxyas thanks for taking a look! rust-clippy/tests/ui/match_same_arms.rs Lines 31 to 38 in 6a3ef93
We generate two suggestions - one to combine 1 and 2, and one to combine 2 and 3. These overlap and the second application fails. It looks like the issue is that we're pairwise matching arms up, rather than collecting all arms that have the same body and suggesting an aggregate fix: rust-clippy/clippy_lints/src/matches/match_same_arms.rs Lines 115 to 116 in 6a3ef93
I'm happy to fix this but feel like it's probably "removed enough" from the multipart_suggestion to throw another issue in and fix it in a separate PR. What do you think? |
I agree with you, fixing that would count as another issue, and opening another PR instead of making this one bigger would help with atomic PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! ❤️
This addresses #13099 for the match_same_arms lint.
changelog: [match_same_arms]: Updated match_same_arms to use multipart_suggestions where appropriate