-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
for
loops implicitly call .into_iter()
on that which is being iterated over, but if someone didn't know this, they might have written .into_iter()
themselves (this is not merely a hypothetical scenario), which is surely bad style.
Example of code that should get a warning (but does not as of Clippy v. 0.0.79):
fn main() {
let my_vec = vec![1, 2, 3, 4];
for i in my_vec.into_iter() {
println!("{}", i);
}
}
(could be just for i in my_vec {
)
I'm guessing the implementation would probably be pretty similar to that of the existing explicit_iter_loop
lint?
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy