1 error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
2 --> $DIR/for_loop.rs:17:14
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.
11 --> $DIR/for_loop.rs:22:14
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.
20 --> $DIR/for_loop.rs:26:14
22 26 | for x in option.ok_or("x not found") {
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
27 error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
28 --> $DIR/for_loop.rs:32:5
30 32 | / for x in v.iter().next() {
31 33 | | println!("{}", x);
35 = note: `-D iter-next-loop` implied by `-D warnings`
37 error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
38 --> $DIR/for_loop.rs:37:14
40 37 | for x in v.iter().next().and(Some(0)) {
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43 = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
45 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.
46 --> $DIR/for_loop.rs:41:14
48 41 | for x in v.iter().next().ok_or("x not found") {
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51 = 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")`
53 error: this loop never actually loops
54 --> $DIR/for_loop.rs:53:5
56 53 | / while let Some(x) = option {
57 54 | | println!("{}", x);
62 = note: `-D never-loop` implied by `-D warnings`
64 error: this loop never actually loops
65 --> $DIR/for_loop.rs:59:5
67 59 | / while let Ok(x) = result {
68 60 | | println!("{}", x);
73 error: the loop variable `i` is only used to index `vec`.
74 --> $DIR/for_loop.rs:86:5
76 86 | / for i in 0..vec.len() {
77 87 | | println!("{}", vec[i]);
81 = note: `-D needless-range-loop` implied by `-D warnings`
82 help: consider using an iterator
84 86 | for <item> in &vec {
87 error: the loop variable `i` is only used to index `vec`.
88 --> $DIR/for_loop.rs:95:5
90 95 | / for i in 0..vec.len() {
91 96 | | let _ = vec[i];
95 help: consider using an iterator
97 95 | for <item> in &vec {
100 error: the loop variable `j` is only used to index `STATIC`.
101 --> $DIR/for_loop.rs:100:5
103 100 | / for j in 0..4 {
104 101 | | println!("{:?}", STATIC[j]);
108 help: consider using an iterator
110 100 | for <item> in STATIC.iter().take(4) {
113 error: the loop variable `j` is only used to index `CONST`.
114 --> $DIR/for_loop.rs:104:5
116 104 | / for j in 0..4 {
117 105 | | println!("{:?}", CONST[j]);
121 help: consider using an iterator
123 104 | for <item> in CONST.iter().take(4) {
126 error: the loop variable `i` is used to index `vec`
127 --> $DIR/for_loop.rs:108:5
129 108 | / for i in 0..vec.len() {
130 109 | | println!("{} {}", vec[i], i);
134 help: consider using an iterator
136 108 | for (i, <item>) in vec.iter().enumerate() {
139 error: the loop variable `i` is only used to index `vec2`.
140 --> $DIR/for_loop.rs:116:5
142 116 | / for i in 0..vec.len() {
143 117 | | println!("{}", vec2[i]);
147 help: consider using an iterator
149 116 | for <item> in vec2.iter().take(vec.len()) {
152 error: the loop variable `i` is only used to index `vec`.
153 --> $DIR/for_loop.rs:120:5
155 120 | / for i in 5..vec.len() {
156 121 | | println!("{}", vec[i]);
160 help: consider using an iterator
162 120 | for <item> in vec.iter().skip(5) {
165 error: the loop variable `i` is only used to index `vec`.
166 --> $DIR/for_loop.rs:124:5
168 124 | / for i in 0..MAX_LEN {
169 125 | | println!("{}", vec[i]);
173 help: consider using an iterator
175 124 | for <item> in vec.iter().take(MAX_LEN) {
178 error: the loop variable `i` is only used to index `vec`.
179 --> $DIR/for_loop.rs:128:5
181 128 | / for i in 0..=MAX_LEN {
182 129 | | println!("{}", vec[i]);
186 help: consider using an iterator
188 128 | for <item> in vec.iter().take(MAX_LEN + 1) {
191 error: the loop variable `i` is only used to index `vec`.
192 --> $DIR/for_loop.rs:132:5
194 132 | / for i in 5..10 {
195 133 | | println!("{}", vec[i]);
199 help: consider using an iterator
201 132 | for <item> in vec.iter().take(10).skip(5) {
204 error: the loop variable `i` is only used to index `vec`.
205 --> $DIR/for_loop.rs:136:5
207 136 | / for i in 5..=10 {
208 137 | | println!("{}", vec[i]);
212 help: consider using an iterator
214 136 | for <item> in vec.iter().take(10 + 1).skip(5) {
217 error: the loop variable `i` is used to index `vec`
218 --> $DIR/for_loop.rs:140:5
220 140 | / for i in 5..vec.len() {
221 141 | | println!("{} {}", vec[i], i);
225 help: consider using an iterator
227 140 | for (i, <item>) in vec.iter().enumerate().skip(5) {
230 error: the loop variable `i` is used to index `vec`
231 --> $DIR/for_loop.rs:144:5
233 144 | / for i in 5..10 {
234 145 | | println!("{} {}", vec[i], i);
238 help: consider using an iterator
240 144 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
243 error: this range is empty so this for loop will never run
244 --> $DIR/for_loop.rs:148:5
246 148 | / for i in 10..0 {
247 149 | | println!("{}", i);
251 = note: `-D reverse-range-loop` implied by `-D warnings`
252 help: consider using the following if you are attempting to iterate over this range in reverse
254 148 | for i in (0..10).rev() {
257 error: this range is empty so this for loop will never run
258 --> $DIR/for_loop.rs:152:5
260 152 | / for i in 10..=0 {
261 153 | | println!("{}", i);
265 help: consider using the following if you are attempting to iterate over this range in reverse
267 152 | for i in (0...10).rev() {
270 error: this range is empty so this for loop will never run
271 --> $DIR/for_loop.rs:156:5
273 156 | / for i in MAX_LEN..0 {
274 157 | | println!("{}", i);
278 help: consider using the following if you are attempting to iterate over this range in reverse
280 156 | for i in (0..MAX_LEN).rev() {
283 error: this range is empty so this for loop will never run
284 --> $DIR/for_loop.rs:160:5
286 160 | / for i in 5..5 {
287 161 | | println!("{}", i);
291 error: this range is empty so this for loop will never run
292 --> $DIR/for_loop.rs:185:5
294 185 | / for i in 10..5 + 4 {
295 186 | | println!("{}", i);
299 help: consider using the following if you are attempting to iterate over this range in reverse
301 185 | for i in (5 + 4..10).rev() {
304 error: this range is empty so this for loop will never run
305 --> $DIR/for_loop.rs:189:5
307 189 | / for i in (5 + 2)..(3 - 1) {
308 190 | | println!("{}", i);
312 help: consider using the following if you are attempting to iterate over this range in reverse
314 189 | for i in ((3 - 1)..(5 + 2)).rev() {
315 | ^^^^^^^^^^^^^^^^^^^^^^^^
317 error: this range is empty so this for loop will never run
318 --> $DIR/for_loop.rs:193:5
320 193 | / for i in (5 + 2)..(8 - 1) {
321 194 | | println!("{}", i);
325 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
326 --> $DIR/for_loop.rs:215:15
328 215 | for _v in vec.iter() {}
329 | ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
331 = note: `-D explicit-iter-loop` implied by `-D warnings`
333 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
334 --> $DIR/for_loop.rs:217:15
336 217 | for _v in vec.iter_mut() {}
337 | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
339 error: it is more idiomatic to loop over containers instead of using explicit iteration methods`
340 --> $DIR/for_loop.rs:220:15
342 220 | for _v in out_vec.into_iter() {}
343 | ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec`
345 = note: `-D explicit-into-iter-loop` implied by `-D warnings`
347 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
348 --> $DIR/for_loop.rs:223:15
350 223 | for _v in array.into_iter() {}
351 | ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&array`
353 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
354 --> $DIR/for_loop.rs:228:15
356 228 | for _v in [1, 2, 3].iter() {}
357 | ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]`
359 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
360 --> $DIR/for_loop.rs:232:15
362 232 | for _v in [0; 32].iter() {}
363 | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]`
365 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
366 --> $DIR/for_loop.rs:237:15
368 237 | for _v in ll.iter() {}
369 | ^^^^^^^^^ help: to write this more concisely, try: `&ll`
371 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
372 --> $DIR/for_loop.rs:240:15
374 240 | for _v in vd.iter() {}
375 | ^^^^^^^^^ help: to write this more concisely, try: `&vd`
377 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
378 --> $DIR/for_loop.rs:243:15
380 243 | for _v in bh.iter() {}
381 | ^^^^^^^^^ help: to write this more concisely, try: `&bh`
383 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
384 --> $DIR/for_loop.rs:246:15
386 246 | for _v in hm.iter() {}
387 | ^^^^^^^^^ help: to write this more concisely, try: `&hm`
389 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
390 --> $DIR/for_loop.rs:249:15
392 249 | for _v in bt.iter() {}
393 | ^^^^^^^^^ help: to write this more concisely, try: `&bt`
395 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
396 --> $DIR/for_loop.rs:252:15
398 252 | for _v in hs.iter() {}
399 | ^^^^^^^^^ help: to write this more concisely, try: `&hs`
401 error: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
402 --> $DIR/for_loop.rs:255:15
404 255 | for _v in bs.iter() {}
405 | ^^^^^^^^^ help: to write this more concisely, try: `&bs`
407 error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
408 --> $DIR/for_loop.rs:257:5
410 257 | for _v in vec.iter().next() {}
411 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
413 error: you are collect()ing an iterator and throwing away the result. Consider using an explicit for loop to exhaust the iterator
414 --> $DIR/for_loop.rs:264:5
416 264 | vec.iter().cloned().map(|x| out.push(x)).collect::<Vec<_>>();
417 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
419 = note: `-D unused-collect` implied by `-D warnings`
421 error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
422 --> $DIR/for_loop.rs:269:5
424 269 | / for _v in &vec {
429 = note: `-D explicit-counter-loop` implied by `-D warnings`
431 error: the variable `_index` is used as a loop counter. Consider using `for (_index, item) in &vec.enumerate()` or similar iterators
432 --> $DIR/for_loop.rs:275:5
434 275 | / for _v in &vec {
439 error: you seem to want to iterate on a map's values
440 --> $DIR/for_loop.rs:385:5
442 385 | / for (_, v) in &m {
447 = note: `-D for-kv-map` implied by `-D warnings`
448 help: use the corresponding method
450 385 | for v in m.values() {
453 error: you seem to want to iterate on a map's values
454 --> $DIR/for_loop.rs:390:5
456 390 | / for (_, v) in &*m {
458 392 | | // Here the `*` is not actually necesarry, but the test tests that we don't
460 394 | | // `in *m.values()` as we used to
464 help: use the corresponding method
466 390 | for v in (*m).values() {
469 error: you seem to want to iterate on a map's values
470 --> $DIR/for_loop.rs:398:5
472 398 | / for (_, v) in &mut m {
477 help: use the corresponding method
479 398 | for v in m.values_mut() {
482 error: you seem to want to iterate on a map's values
483 --> $DIR/for_loop.rs:403:5
485 403 | / for (_, v) in &mut *m {
490 help: use the corresponding method
492 403 | for v in (*m).values_mut() {
495 error: you seem to want to iterate on a map's keys
496 --> $DIR/for_loop.rs:409:5
498 409 | / for (k, _value) in rm {
503 help: use the corresponding method
505 409 | for k in rm.keys() {
508 error: it looks like you're manually copying between slices
509 --> $DIR/for_loop.rs:462:5
511 462 | / for i in 0..src.len() {
512 463 | | dst[i] = src[i];
514 | |_____^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`
516 = note: `-D manual-memcpy` implied by `-D warnings`
518 error: it looks like you're manually copying between slices
519 --> $DIR/for_loop.rs:467:5
521 467 | / for i in 0..src.len() {
522 468 | | dst[i + 10] = src[i];
524 | |_____^ help: try replacing the loop by: `dst[10..(src.len() + 10)].clone_from_slice(&src[..])`
526 error: it looks like you're manually copying between slices
527 --> $DIR/for_loop.rs:472:5
529 472 | / for i in 0..src.len() {
530 473 | | dst[i] = src[i + 10];
532 | |_____^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[10..])`
534 error: it looks like you're manually copying between slices
535 --> $DIR/for_loop.rs:477:5
537 477 | / for i in 11..src.len() {
538 478 | | dst[i] = src[i - 10];
540 | |_____^ help: try replacing the loop by: `dst[11..src.len()].clone_from_slice(&src[(11 - 10)..(src.len() - 10)])`
542 error: it looks like you're manually copying between slices
543 --> $DIR/for_loop.rs:482:5
545 482 | / for i in 0..dst.len() {
546 483 | | dst[i] = src[i];
548 | |_____^ help: try replacing the loop by: `dst.clone_from_slice(&src[..dst.len()])`
550 error: it looks like you're manually copying between slices
551 --> $DIR/for_loop.rs:495:5
553 495 | / for i in 10..256 {
554 496 | | dst[i] = src[i - 5];
555 497 | | dst2[i + 500] = src[i]
559 help: try replacing the loop by
561 495 | dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)])
562 496 | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256])
565 error: it looks like you're manually copying between slices
566 --> $DIR/for_loop.rs:507:5
568 507 | / for i in 10..LOOP_OFFSET {
569 508 | | dst[i + LOOP_OFFSET] = src[i - some_var];
571 | |_____^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].clone_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)])`
573 error: it looks like you're manually copying between slices
574 --> $DIR/for_loop.rs:520:5
576 520 | / for i in 0..src_vec.len() {
577 521 | | dst_vec[i] = src_vec[i];
579 | |_____^ help: try replacing the loop by: `dst_vec[..src_vec.len()].clone_from_slice(&src_vec[..])`
581 error: it looks like you're manually copying between slices
582 --> $DIR/for_loop.rs:547:5
584 547 | / for i in 0..src.len() {
585 548 | | dst[i] = src[i].clone();
587 | |_____^ help: try replacing the loop by: `dst[..src.len()].clone_from_slice(&src[..])`