1 error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
7 = note: `-D for-loop-over-option` implied by `-D warnings`
8 = help: consider replacing `for x in option` with `if let Some(x) = option`
10 error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement.
13 22 | for x in result {
16 = note: `-D for-loop-over-result` implied by `-D warnings`
17 = help: consider replacing `for x in result` with `if let Ok(x) = result`
19 error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
22 26 | for x in option.ok_or("x not found") {
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 = note: `-D for-loop-over-result` implied by `-D warnings`
26 = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
28 error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
31 31 | / for x in v.iter().next() {
32 32 | | println!("{}", x);
36 = note: `-D iter-next-loop` implied by `-D warnings`
38 error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
41 36 | for x in v.iter().next().and(Some(0)) {
42 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 = note: `-D for-loop-over-option` implied by `-D warnings`
45 = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
47 error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
50 40 | for x in v.iter().next().ok_or("x not found") {
51 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53 = note: `-D for-loop-over-result` implied by `-D warnings`
54 = help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`
56 error: this loop never actually loops
59 52 | / while let Some(x) = option {
60 53 | | println!("{}", x);
65 = note: `-D never-loop` implied by `-D warnings`
67 error: this loop never actually loops
70 58 | / while let Ok(x) = result {
71 59 | | println!("{}", x);
76 = note: `-D never-loop` implied by `-D warnings`
78 error: the loop variable `i` is only used to index `vec`.
81 84 | / for i in 0..vec.len() {
82 85 | | println!("{}", vec[i]);
86 = note: `-D needless-range-loop` implied by `-D warnings`
87 help: consider using an iterator
88 | for <item> in &vec {
90 error: unused variable: `i`
93 88 | for i in 0..vec.len() {
96 = note: `-D unused-variables` implied by `-D warnings`
98 error: the loop variable `i` is only used to index `vec`.
101 93 | for i in 0..vec.len() { let _ = vec[i]; }
102 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104 = note: `-D needless-range-loop` implied by `-D warnings`
105 help: consider using an iterator
106 | for <item> in &vec { let _ = vec[i]; }
108 error: the loop variable `j` is only used to index `STATIC`.
111 96 | / for j in 0..4 {
112 97 | | println!("{:?}", STATIC[j]);
116 = note: `-D needless-range-loop` implied by `-D warnings`
117 help: consider using an iterator
118 | for <item> in STATIC.iter().take(4) {
120 error: the loop variable `j` is only used to index `CONST`.
121 --> for_loop.rs:100:5
123 100 | / for j in 0..4 {
124 101 | | println!("{:?}", CONST[j]);
128 = note: `-D needless-range-loop` implied by `-D warnings`
129 help: consider using an iterator
130 | for <item> in CONST.iter().take(4) {
132 error: the loop variable `i` is used to index `vec`
133 --> for_loop.rs:104:5
135 104 | / for i in 0..vec.len() {
136 105 | | println!("{} {}", vec[i], i);
140 = note: `-D needless-range-loop` implied by `-D warnings`
141 help: consider using an iterator
142 | for (i, <item>) in vec.iter().enumerate() {
144 error: the loop variable `i` is only used to index `vec2`.
145 --> for_loop.rs:111:5
147 111 | / for i in 0..vec.len() {
148 112 | | println!("{}", vec2[i]);
152 = note: `-D needless-range-loop` implied by `-D warnings`
153 help: consider using an iterator
154 | for <item> in vec2.iter().take(vec.len()) {
156 error: the loop variable `i` is only used to index `vec`.
157 --> for_loop.rs:115:5
159 115 | / for i in 5..vec.len() {
160 116 | | println!("{}", vec[i]);
164 = note: `-D needless-range-loop` implied by `-D warnings`
165 help: consider using an iterator
166 | for <item> in vec.iter().skip(5) {
168 error: the loop variable `i` is only used to index `vec`.
169 --> for_loop.rs:119:5
171 119 | / for i in 0..MAX_LEN {
172 120 | | println!("{}", vec[i]);
176 = note: `-D needless-range-loop` implied by `-D warnings`
177 help: consider using an iterator
178 | for <item> in vec.iter().take(MAX_LEN) {
180 error: the loop variable `i` is only used to index `vec`.
181 --> for_loop.rs:123:5
183 123 | / for i in 0...MAX_LEN {
184 124 | | println!("{}", vec[i]);
188 = note: `-D needless-range-loop` implied by `-D warnings`
189 help: consider using an iterator
190 | for <item> in vec.iter().take(MAX_LEN + 1) {
192 error: the loop variable `i` is only used to index `vec`.
193 --> for_loop.rs:127:5
195 127 | / for i in 5..10 {
196 128 | | println!("{}", vec[i]);
200 = note: `-D needless-range-loop` implied by `-D warnings`
201 help: consider using an iterator
202 | for <item> in vec.iter().take(10).skip(5) {
204 error: the loop variable `i` is only used to index `vec`.
205 --> for_loop.rs:131:5
207 131 | / for i in 5...10 {
208 132 | | println!("{}", vec[i]);
212 = note: `-D needless-range-loop` implied by `-D warnings`
213 help: consider using an iterator
214 | for <item> in vec.iter().take(10 + 1).skip(5) {
216 error: the loop variable `i` is used to index `vec`
217 --> for_loop.rs:135:5
219 135 | / for i in 5..vec.len() {
220 136 | | println!("{} {}", vec[i], i);
224 = note: `-D needless-range-loop` implied by `-D warnings`
225 help: consider using an iterator
226 | for (i, <item>) in vec.iter().enumerate().skip(5) {
228 error: the loop variable `i` is used to index `vec`
229 --> for_loop.rs:139:5
231 139 | / for i in 5..10 {
232 140 | | println!("{} {}", vec[i], i);
236 = note: `-D needless-range-loop` implied by `-D warnings`
237 help: consider using an iterator
238 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
240 error: this range is empty so this for loop will never run
241 --> for_loop.rs:143:5
243 143 | / for i in 10..0 {
244 144 | | println!("{}", i);
248 = note: `-D reverse-range-loop` implied by `-D warnings`
249 help: consider using the following if you are attempting to iterate over this range in reverse
250 | for i in (0..10).rev() {
252 error: this range is empty so this for loop will never run
253 --> for_loop.rs:147:5
255 147 | / for i in 10...0 {
256 148 | | println!("{}", i);
260 = note: `-D reverse-range-loop` implied by `-D warnings`
261 help: consider using the following if you are attempting to iterate over this range in reverse
262 | for i in (0...10).rev() {
264 error: this range is empty so this for loop will never run
265 --> for_loop.rs:151:5
267 151 | / for i in MAX_LEN..0 {
268 152 | | println!("{}", i);
272 = note: `-D reverse-range-loop` implied by `-D warnings`
273 help: consider using the following if you are attempting to iterate over this range in reverse
274 | for i in (0..MAX_LEN).rev() {
276 error: this range is empty so this for loop will never run
277 --> for_loop.rs:155:5
279 155 | / for i in 5..5 {
280 156 | | println!("{}", i);
284 = note: `-D reverse-range-loop` implied by `-D warnings`
286 error: this range is empty so this for loop will never run
287 --> for_loop.rs:176:5
289 176 | / for i in 10..5+4 {
290 177 | | println!("{}", i);
294 = note: `-D reverse-range-loop` implied by `-D warnings`
295 help: consider using the following if you are attempting to iterate over this range in reverse
296 | for i in (5+4..10).rev() {
298 error: this range is empty so this for loop will never run
299 --> for_loop.rs:180:5
301 180 | / for i in (5+2)..(3-1) {
302 181 | | println!("{}", i);
306 = note: `-D reverse-range-loop` implied by `-D warnings`
307 help: consider using the following if you are attempting to iterate over this range in reverse
308 | for i in ((3-1)..(5+2)).rev() {
310 error: this range is empty so this for loop will never run
311 --> for_loop.rs:184:5
313 184 | / for i in (5+2)..(8-1) {
314 185 | | println!("{}", i);
318 = note: `-D reverse-range-loop` implied by `-D warnings`
320 error: use of deprecated item: replaced by `Iterator::step_by`
321 --> for_loop.rs:192:22
323 192 | for i in (10..8).step_by(-1) {
326 = note: `-D deprecated` implied by `-D warnings`
328 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
329 --> for_loop.rs:207:15
331 207 | for _v in vec.iter() { }
332 | ^^^^^^^^^^ help: to write this more concisely, try `&vec`
334 = note: `-D explicit-iter-loop` implied by `-D warnings`
336 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
337 --> for_loop.rs:209:15
339 209 | for _v in vec.iter_mut() { }
340 | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&mut vec`
342 = note: `-D explicit-iter-loop` implied by `-D warnings`
344 error: it is more idiomatic to loop over containers instead of using explicit iteration methods`
345 --> for_loop.rs:212:15
347 212 | for _v in out_vec.into_iter() { }
348 | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `out_vec`
350 = note: `-D explicit-into-iter-loop` implied by `-D warnings`
352 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
353 --> for_loop.rs:215:15
355 215 | for _v in array.into_iter() {}
356 | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&array`
358 = note: `-D explicit-iter-loop` implied by `-D warnings`
360 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
361 --> for_loop.rs:220:15
363 220 | for _v in [1, 2, 3].iter() { }
364 | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try `&[1, 2, 3]`
366 = note: `-D explicit-iter-loop` implied by `-D warnings`
368 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
369 --> for_loop.rs:224:15
371 224 | for _v in [0; 32].iter() {}
372 | ^^^^^^^^^^^^^^ help: to write this more concisely, try `&[0; 32]`
374 = note: `-D explicit-iter-loop` implied by `-D warnings`
376 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
377 --> for_loop.rs:229:15
379 229 | for _v in ll.iter() { }
380 | ^^^^^^^^^ help: to write this more concisely, try `&ll`
382 = note: `-D explicit-iter-loop` implied by `-D warnings`
384 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
385 --> for_loop.rs:232:15
387 232 | for _v in vd.iter() { }
388 | ^^^^^^^^^ help: to write this more concisely, try `&vd`
390 = note: `-D explicit-iter-loop` implied by `-D warnings`
392 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
393 --> for_loop.rs:235:15
395 235 | for _v in bh.iter() { }
396 | ^^^^^^^^^ help: to write this more concisely, try `&bh`
398 = note: `-D explicit-iter-loop` implied by `-D warnings`
400 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
401 --> for_loop.rs:238:15
403 238 | for _v in hm.iter() { }
404 | ^^^^^^^^^ help: to write this more concisely, try `&hm`
406 = note: `-D explicit-iter-loop` implied by `-D warnings`
408 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
409 --> for_loop.rs:241:15
411 241 | for _v in bt.iter() { }
412 | ^^^^^^^^^ help: to write this more concisely, try `&bt`
414 = note: `-D explicit-iter-loop` implied by `-D warnings`
416 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
417 --> for_loop.rs:244:15
419 244 | for _v in hs.iter() { }
420 | ^^^^^^^^^ help: to write this more concisely, try `&hs`
422 = note: `-D explicit-iter-loop` implied by `-D warnings`
424 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
425 --> for_loop.rs:247:15
427 247 | for _v in bs.iter() { }
428 | ^^^^^^^^^ help: to write this more concisely, try `&bs`
430 = note: `-D explicit-iter-loop` implied by `-D warnings`
432 error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
433 --> for_loop.rs:249:5
435 249 | for _v in vec.iter().next() { }
436 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
438 = note: `-D iter-next-loop` implied by `-D warnings`
440 error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
441 --> for_loop.rs:256:5
443 256 | vec.iter().map(|x| out.push(x)).collect::<Vec<_>>();
444 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
446 = note: `-D unused-collect` implied by `-D warnings`
448 error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
449 --> for_loop.rs:261:5
451 261 | for _v in &vec { _index += 1 }
452 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
454 = note: `-D explicit-counter-loop` implied by `-D warnings`
456 error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
457 --> for_loop.rs:265:5
459 265 | for _v in &vec { _index += 1 }
460 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
462 = note: `-D explicit-counter-loop` implied by `-D warnings`
464 error: you seem to want to iterate on a map's values
465 --> for_loop.rs:325:5
467 325 | / for (_, v) in &m {
472 = note: `-D for-kv-map` implied by `-D warnings`
473 help: use the corresponding method
474 | for v in m.values() {
476 error: you seem to want to iterate on a map's values
477 --> for_loop.rs:330:5
479 330 | / for (_, v) in &*m {
481 332 | | // Here the `*` is not actually necesarry, but the test tests that we don't suggest
482 333 | | // `in *m.values()` as we used to
486 = note: `-D for-kv-map` implied by `-D warnings`
487 help: use the corresponding method
488 | for v in (*m).values() {
490 error: you seem to want to iterate on a map's values
491 --> for_loop.rs:337:5
493 337 | / for (_, v) in &mut m {
498 = note: `-D for-kv-map` implied by `-D warnings`
499 help: use the corresponding method
500 | for v in m.values_mut() {
502 error: you seem to want to iterate on a map's values
503 --> for_loop.rs:342:5
505 342 | / for (_, v) in &mut *m {
510 = note: `-D for-kv-map` implied by `-D warnings`
511 help: use the corresponding method
512 | for v in (*m).values_mut() {
514 error: you seem to want to iterate on a map's keys
515 --> for_loop.rs:348:5
517 348 | / for (k, _value) in rm {
522 = note: `-D for-kv-map` implied by `-D warnings`
523 help: use the corresponding method
524 | for k in rm.keys() {
526 error: aborting due to previous error(s)
528 error: Could not compile `clippy_tests`.
530 To learn more, run the command again with --verbose.