We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 387e099 commit e6b905dCopy full SHA for e6b905d
tests/compile-fail/for_loop.rs
@@ -32,6 +32,11 @@ fn main() {
32
println!("{} {}", vec[i], vec2[i]);
33
}
34
35
+ for i in 0..vec.len() {
36
+ //~^ ERROR `i` is only used to index `vec2`. Consider using `for item in vec2.iter().take(vec.len())`
37
+ println!("{}", vec2[i]);
38
+ }
39
+
40
for i in 5..vec.len() {
41
//~^ ERROR `i` is only used to index `vec`. Consider using `for item in vec.iter().skip(5)`
42
println!("{}", vec[i]);
0 commit comments