-
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
Wrong hint about needless_range_loop #878
Comments
It looks more complicated but you don't have to worry about bounds checks. |
No, I need to access two items at different position. In this case, I need to access |
I think the proper way would be something like for (&a, &b) in v[2..].iter().zip(&v) {
println!("{}", a - b);
} |
(While there are ways of doing this with iterators, the hint should still be improved) |
@oli-obk I think my version is more clean and simple. :) |
@BusyJay you need to specify the |
Maybe |
Is this issue still relevant today? It doesn't seem to lint on the code provided anymore: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ac000dbc5a08cd445b4babe76f6176bf |
Yeah that lint has gotten tons of improvement but we probably had duplicate issues filed. Nice catch! |
Clippy warns about following snippet:
It suggest me to use
enumerate
. But I don't think I can useenumerate
in this situation.The text was updated successfully, but these errors were encountered: