about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr
blob: 6bc56db68a0ecb189284464025a58131cec3d7c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
error: needless use of `for_each`
  --> tests/ui/needless_for_each_unfixable.rs:8:5
   |
LL | /     v.iter().for_each(|v| {
LL | |
LL | |
LL | |         if *v == 10 {
...  |
LL | |     });
   | |_______^
   |
   = note: `-D clippy::needless-for-each` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_for_each)]`
help: try
   |
LL ~     for v in v.iter() {
LL +
LL + 
LL +         if *v == 10 {
LL +             return;
LL +         } else {
LL +             println!("{v}");
LL +         }
LL +     }
   |
help: ...and replace `return` with `continue`
   |
LL -             return;
LL +             continue;
   |

error: needless use of `for_each`
  --> tests/ui/needless_for_each_unfixable.rs:22:5
   |
LL | /     [].iter().for_each(move |_: &i32| {
LL | |
LL | |         i += 1;
LL | |     });
   | |_______^
   |
help: try
   |
LL ~     for _ in [].iter() {
LL +
LL +         i += 1;
LL +     }
   |

error: needless use of `for_each`
  --> tests/ui/needless_for_each_unfixable.rs:28:5
   |
LL | /     [1i32].iter().for_each(move |_: &i32| {
LL | |
LL | |         i += 1;
LL | |     });
   | |_______^
   |
help: try
   |
LL ~     for _ in [1i32].iter() {
LL +
LL +         i += 1;
LL +     }
   |

error: aborting due to 3 previous errors