@@ -4,6 +4,7 @@ error: the loop variable `i` is only used to index `vec`
44LL | for i in 0..vec.len() {
55 | ^^^^^^^^^^^^
66 |
7+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
78 = note: `-D clippy::needless-range-loop` implied by `-D warnings`
89 = help: to override `-D warnings` add `#[allow(clippy::needless_range_loop)]`
910help: consider using an iterator
@@ -18,6 +19,7 @@ error: the loop variable `i` is only used to index `vec`
1819LL | for i in 0..vec.len() {
1920 | ^^^^^^^^^^^^
2021 |
22+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
2123help: consider using an iterator
2224 |
2325LL - for i in 0..vec.len() {
@@ -30,6 +32,7 @@ error: the loop variable `j` is only used to index `STATIC`
3032LL | for j in 0..4 {
3133 | ^^^^
3234 |
35+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
3336help: consider using an iterator
3437 |
3538LL - for j in 0..4 {
@@ -42,6 +45,7 @@ error: the loop variable `j` is only used to index `CONST`
4245LL | for j in 0..4 {
4346 | ^^^^
4447 |
48+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
4549help: consider using an iterator
4650 |
4751LL - for j in 0..4 {
@@ -66,10 +70,11 @@ error: the loop variable `i` is only used to index `vec2`
6670LL | for i in 0..vec.len() {
6771 | ^^^^^^^^^^^^
6872 |
73+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
6974help: consider using an iterator
7075 |
7176LL - for i in 0..vec.len() {
72- LL + for <item> in vec2.iter().take( vec.len()) {
77+ LL + for <item> in vec2[.. vec.len()].iter( ) {
7378 |
7479
7580error: the loop variable `i` is only used to index `vec`
@@ -78,6 +83,7 @@ error: the loop variable `i` is only used to index `vec`
7883LL | for i in 5..vec.len() {
7984 | ^^^^^^^^^^^^
8085 |
86+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
8187help: consider using an iterator
8288 |
8389LL - for i in 5..vec.len() {
@@ -90,10 +96,11 @@ error: the loop variable `i` is only used to index `vec`
9096LL | for i in 0..MAX_LEN {
9197 | ^^^^^^^^^^
9298 |
99+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
93100help: consider using an iterator
94101 |
95102LL - for i in 0..MAX_LEN {
96- LL + for <item> in vec.iter().take( MAX_LEN) {
103+ LL + for <item> in vec[.. MAX_LEN].iter( ) {
97104 |
98105
99106error: the loop variable `i` is only used to index `vec`
@@ -102,10 +109,11 @@ error: the loop variable `i` is only used to index `vec`
102109LL | for i in 0..=MAX_LEN {
103110 | ^^^^^^^^^^^
104111 |
112+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
105113help: consider using an iterator
106114 |
107115LL - for i in 0..=MAX_LEN {
108- LL + for <item> in vec.iter().take( MAX_LEN + 1 ) {
116+ LL + for <item> in vec[.. MAX_LEN].iter( ) {
109117 |
110118
111119error: the loop variable `i` is only used to index `vec`
@@ -114,10 +122,11 @@ error: the loop variable `i` is only used to index `vec`
114122LL | for i in 5..10 {
115123 | ^^^^^
116124 |
125+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
117126help: consider using an iterator
118127 |
119128LL - for i in 5..10 {
120- LL + for <item> in vec.iter().take(10 ).skip(5) {
129+ LL + for <item> in vec[..10].iter( ).skip(5) {
121130 |
122131
123132error: the loop variable `i` is only used to index `vec`
@@ -126,10 +135,11 @@ error: the loop variable `i` is only used to index `vec`
126135LL | for i in 5..=10 {
127136 | ^^^^^^
128137 |
138+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
129139help: consider using an iterator
130140 |
131141LL - for i in 5..=10 {
132- LL + for <item> in vec.iter().take(10 + 1 ).skip(5) {
142+ LL + for <item> in vec[..10].iter( ).skip(5) {
133143 |
134144
135145error: the loop variable `i` is used to index `vec`
@@ -186,10 +196,11 @@ error: the loop variable `i` is only used to index `a`
186196LL | for i in 0..MAX_LEN {
187197 | ^^^^^^^^^^
188198 |
199+ = note: this suggestion preserves panic behavior, but the panic will occur before iteration if the upper bound exceeds the collection length
189200help: consider using an iterator
190201 |
191202LL - for i in 0..MAX_LEN {
192- LL + for <item> in a.iter().take( MAX_LEN) {
203+ LL + for <item> in a[.. MAX_LEN].iter( ) {
193204 |
194205
195206error: aborting due to 16 previous errors
0 commit comments