-
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
Add let_underscore_drop
#6305
Add let_underscore_drop
#6305
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
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.
Don't forget to update the reference files and run cargo dev update_lints
after applying the review.
Co-authored-by: Philipp Krones <[email protected]>
Co-authored-by: Philipp Krones <[email protected]>
Co-authored-by: Philipp Krones <[email protected]>
@flip1995 Thanks for the review. Could you please sanity check that this was the right way to address the |
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.
Could you please sanity check that this was the right way to address the
map_clone
andmap_flatten
tests?
LGTM
tests/ui/filter_methods.stderr
Outdated
@@ -1,3 +1,12 @@ | |||
error: non-binding `let` on a type that implements `Drop` |
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.
Please also allow the lint in tests/ui/filter_methods.rs
. Or better, swap out
rust-clippy/tests/ui/filter_methods.rs
Lines 1 to 2 in 06e81bb
#![warn(clippy::all, clippy::pedantic)] | |
#![allow(clippy::missing_docs_in_private_items)] |
With just
#![warn(clippy::filter_map)]
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.
Or better, ...
As an outsider, a change like that looks to me like it would go against an established convention. Maybe it would be better left for a separate 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.
It is an ancient convention to warn on all lints in test files. Now one test file should only test one lint. But we don't care enough about this to fix that.
So both's fine.
@bors r+ Thanks! |
📌 Commit 4852cca has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This line generalizes
let_underscore_lock
(#5101) to warn about any initializer expression that implementsDrop
.So, for example, the following would generate a warning:
I tried to preserve the original
let_underscore_lock
functionality in the sense that the warning generated forshould be unchanged.
Please keep the line below
changelog: Add lint [
let_underscore_drop
]