-
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
Fix: redundant_pattern_matching drop order #6568
Conversation
r? @flip1995 (rust-highfive has picked a reviewer for you, use r? to override) |
The test seems to fail because |
f511873
to
ffd759d
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.
I'm totally lost. I don't understand what any of this code does. Please add more (doc) comments to the functions better describing it.
The only thing I found reviewing this is that the get_temporary_tys
may be better implemented by a visitor.
ping from triage @Jarcho. Could you have any update on this? |
ping from triage @Jarcho. According to the triage procedure, I'm closing this because 2 weeks have passed with no activity. If you have more time to work on this, feel free to reopen this. |
Great timing, I just went through and cleaned it up. I don't have the ability to re-open. |
@Jarcho Thanks! I reopened this. |
ping from triage @Jarcho. Could you have any update on this? |
☔ The latest upstream changes (presumably #6891) made this pull request unmergeable. Please resolve the merge conflicts. |
@flip1995 Anything else to point out? |
I'll have to take another look at this PR. |
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.
Implementation LGTM. I have 2 questions remaining.
3634c91
to
ee9188f
Compare
☔ The latest upstream changes (presumably #6931) made this pull request unmergeable. Please resolve the merge conflicts. |
ee9188f
to
7ecaf58
Compare
☔ The latest upstream changes (presumably #7047) made this pull request unmergeable. Please resolve the merge conflicts. |
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. Needs a rebase and a comment on the type_needs_ordered
drop with the explanation you provided in the discussion above.
7ecaf58
to
e4d402f
Compare
☔ The latest upstream changes (presumably #7049) made this pull request unmergeable. Please resolve the merge conflicts. |
Add a note when the drop order change may result in different behaviour.
… trait # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Fri Apr 2 19:04:45 2021 -0400 # # On branch redundant_pattern_matching # Your branch is ahead of 'origin/redundant_pattern_matching' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: clippy_lints/src/matches.rs # # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Fri Apr 2 19:04:45 2021 -0400 # # interactive rebase in progress; onto ebc6469 # Last commands done (6 commands done): # pick 25d211a Code cleanup and additional std types checked # r 0c71ce5 `redundant_pattern_matching` fix inverted boolean when missing `Drop` trait # No commands remaining. # You are currently editing a commit while rebasing branch 'redundant_pattern_matching' on 'ebc64690d'. # # Changes to be committed: # modified: clippy_lints/src/matches.rs #
e4d402f
to
c02baba
Compare
@bors r+ Thanks! Great job! |
📌 Commit c02baba has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #5746
A note about the change in drop order is added when the scrutinee (or any temporary in the expression) isn't known to be safe to drop in any order (i.e. doesn't implement the
Drop
trait, or contain such a type). There is a whitelist for somestd
types, but it's incomplete. Currently justVec<_>
,Box<_>
,Rc<_>
andArc<_>
, but only if the contained type is also safe to drop in any order.Another lint for when the drop order changes could be added as allowed by default, but the drop order requirement is pretty subtle in this case. I think the note added to the lint should be enough to make someone think before applying the change.
changelog: Added a note to
redundant_pattern_matching
when the change in drop order might matter