| error: the loop variable `i` is only used to index `ns` |
| --> tests/ui/needless_range_loop2.rs:11:14 |
| | |
| LL | for i in 3..10 { |
| | ^^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:14:24 |
| | |
| LL | println!("{}", ns[i]); |
| | ^^^^^ |
| = note: `-D clippy::needless-range-loop` implied by `-D warnings` |
| = help: to override `-D warnings` add `#[allow(clippy::needless_range_loop)]` |
| help: consider using an iterator |
| | |
| LL - for i in 3..10 { |
| LL + for <item> in ns.iter().take(10).skip(3) { |
| | |
| |
| error: the loop variable `i` is only used to index `ms` |
| --> tests/ui/needless_range_loop2.rs:34:14 |
| | |
| LL | for i in 0..ms.len() { |
| | ^^^^^^^^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:37:9 |
| | |
| LL | ms[i] *= 2; |
| | ^^^^^ |
| help: consider using an iterator |
| | |
| LL - for i in 0..ms.len() { |
| LL + for <item> in &mut ms { |
| | |
| |
| error: the loop variable `i` is only used to index `ms` |
| --> tests/ui/needless_range_loop2.rs:42:14 |
| | |
| LL | for i in 0..ms.len() { |
| | ^^^^^^^^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:45:22 |
| | |
| LL | let x = &mut ms[i]; |
| | ^^^^^ |
| help: consider using an iterator |
| | |
| LL - for i in 0..ms.len() { |
| LL + for <item> in &mut ms { |
| | |
| |
| error: the loop variable `i` is only used to index `vec` |
| --> tests/ui/needless_range_loop2.rs:68:14 |
| | |
| LL | for i in x..x + 4 { |
| | ^^^^^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:71:9 |
| | |
| LL | vec[i] += 1; |
| | ^^^^^^ |
| help: consider using an iterator |
| | |
| LL - for i in x..x + 4 { |
| LL + for <item> in vec.iter_mut().skip(x).take(4) { |
| | |
| |
| error: the loop variable `i` is only used to index `vec` |
| --> tests/ui/needless_range_loop2.rs:77:14 |
| | |
| LL | for i in x..=x + 4 { |
| | ^^^^^^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:80:9 |
| | |
| LL | vec[i] += 1; |
| | ^^^^^^ |
| help: consider using an iterator |
| | |
| LL - for i in x..=x + 4 { |
| LL + for <item> in vec.iter_mut().skip(x).take(4 + 1) { |
| | |
| |
| error: the loop variable `i` is only used to index `arr` |
| --> tests/ui/needless_range_loop2.rs:85:14 |
| | |
| LL | for i in 0..3 { |
| | ^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:88:24 |
| | |
| LL | println!("{}", arr[i]); |
| | ^^^^^^ |
| help: consider using an iterator |
| | |
| LL - for i in 0..3 { |
| LL + for <item> in &arr { |
| | |
| |
| error: the loop variable `i` is only used to index `arr` |
| --> tests/ui/needless_range_loop2.rs:91:14 |
| | |
| LL | for i in 0..2 { |
| | ^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:94:24 |
| | |
| LL | println!("{}", arr[i]); |
| | ^^^^^^ |
| help: consider using an iterator |
| | |
| LL - for i in 0..2 { |
| LL + for <item> in arr.iter().take(2) { |
| | |
| |
| error: the loop variable `i` is only used to index `arr` |
| --> tests/ui/needless_range_loop2.rs:97:14 |
| | |
| LL | for i in 1..3 { |
| | ^^^^ |
| | |
| note: for this index operation |
| --> tests/ui/needless_range_loop2.rs:100:24 |
| | |
| LL | println!("{}", arr[i]); |
| | ^^^^^^ |
| help: consider using an iterator |
| | |
| LL - for i in 1..3 { |
| LL + for <item> in arr.iter().skip(1) { |
| | |
| |
| error: aborting due to 8 previous errors |
| |