We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello, While coding on my Rust project i encountered something that would definitely make sense to have as a clippy lint.
Problematic code
let array = [1, 2, 3]; for (i, _) in array.iter().enumerate() { // the array data is not used we only need the len }
Better alternative
let array = [1, 2, 3]; for i in 0..array.len() { // we only use the len }
This is cleaner and also may faster since we don't have to iterate over the array anymore
uneeded_iter_loop
I tried this code:
I expected to see this happen: A clippy warn
Instead, this happened: No clippy warn
rustc: 1.85-stable
The text was updated successfully, but these errors were encountered:
@rustbot claim
Sorry, something went wrong.
unused_enumerate_value
profetia
Successfully merging a pull request may close this issue.
Summary
Hello, While coding on my Rust project i encountered something that would definitely make sense to have as a clippy lint.
Problematic code
Better alternative
This is cleaner and also may faster since we don't have to iterate over the array anymore
Lint Name
uneeded_iter_loop
Reproducer
I tried this code:
I expected to see this happen:
A clippy warn
Instead, this happened:
No clippy warn
Version
The text was updated successfully, but these errors were encountered: