-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
improve [for_loops_over_fallibles
] to detect the usage of iter, iter_mut and into_iterator
#8941
Conversation
r? @llogiq (rust-highfive has picked a reviewer for you, use r? to override) |
…t and into_iterator
21fca07
to
5a49918
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.
Thank you for making clippy better! I have but a small nit, otherwise it looks merge-worthy.
tests/ui/for_loops_over_fallibles.rs
Outdated
// check over a `Result` | ||
for x in result.into_iter() { | ||
println!("{}", x); | ||
} | ||
|
||
// check over a `Result` | ||
for x in result.iter_mut() { | ||
println!("{}", x); | ||
} | ||
|
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 would have switched the order of those. If result
wasn't Copy
, this would consume it before borrowing it mutably.
Thanks! 👍 @bors r+ |
📌 Commit 3737abe has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fix #6762
detects code like
changelog: Improve [
for_loops_over_fallibles
] to detectfor _ in option.iter() {}
or usingiter_mut()
orinto_iterator()
.