]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_for_each_unfixable.stderr
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / needless_for_each_unfixable.stderr
1 error: needless use of `for_each`
2   --> $DIR/needless_for_each_unfixable.rs:7:5
3    |
4 LL | /     v.iter().for_each(|v| {
5 LL | |         if *v == 10 {
6 LL | |             return;
7 LL | |         } else {
8 LL | |             println!("{}", v);
9 LL | |         }
10 LL | |     });
11    | |_______^
12    |
13    = note: `-D clippy::needless-for-each` implied by `-D warnings`
14 help: try
15    |
16 LL ~     for v in v.iter() {
17 LL +         if *v == 10 {
18 LL +             return;
19 LL +         } else {
20 LL +             println!("{}", v);
21 LL +         }
22 LL +     }
23    |
24 help: ...and replace `return` with `continue`
25    |
26 LL |             continue;
27    |             ~~~~~~~~
28
29 error: aborting due to previous error
30