]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/manual_find_fixable.stderr
Rollup merge of #102110 - CleanCut:migrate_rustc_passes_diagnostics, r=davidtwco
[rust.git] / src / tools / clippy / tests / ui / manual_find_fixable.stderr
1 error: manual implementation of `Iterator::find`
2   --> $DIR/manual_find_fixable.rs:11:5
3    |
4 LL | /     for &v in ARRAY {
5 LL | |         if v == n {
6 LL | |             return Some(v);
7 LL | |         }
8 LL | |     }
9 LL | |     None
10    | |________^ help: replace with an iterator: `ARRAY.iter().find(|&&v| v == n).copied()`
11    |
12    = note: `-D clippy::manual-find` implied by `-D warnings`
13
14 error: manual implementation of `Iterator::find`
15   --> $DIR/manual_find_fixable.rs:20:5
16    |
17 LL | /     for (a, _) in arr {
18 LL | |         if a % 2 == 0 {
19 LL | |             return Some(a);
20 LL | |         }
21 LL | |     }
22 LL | |     None
23    | |________^ help: replace with an iterator: `arr.into_iter().map(|(a, _)| a).find(|&a| a % 2 == 0)`
24
25 error: manual implementation of `Iterator::find`
26   --> $DIR/manual_find_fixable.rs:33:5
27    |
28 LL | /     for el in arr {
29 LL | |         if el.name.len() == 10 {
30 LL | |             return Some(el);
31 LL | |         }
32 LL | |     }
33 LL | |     None
34    | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.name.len() == 10)`
35    |
36    = note: you may need to dereference some variables
37
38 error: manual implementation of `Iterator::find`
39   --> $DIR/manual_find_fixable.rs:43:5
40    |
41 LL | /     for Tuple(a, _) in arr {
42 LL | |         if a >= 3 {
43 LL | |             return Some(a);
44 LL | |         }
45 LL | |     }
46 LL | |     None
47    | |________^ help: replace with an iterator: `arr.into_iter().map(|Tuple(a, _)| a).find(|&a| a >= 3)`
48
49 error: manual implementation of `Iterator::find`
50   --> $DIR/manual_find_fixable.rs:58:5
51    |
52 LL | /     for el in arr {
53 LL | |         if el.should_keep() {
54 LL | |             return Some(el);
55 LL | |         }
56 LL | |     }
57 LL | |     None
58    | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.should_keep())`
59    |
60    = note: you may need to dereference some variables
61
62 error: manual implementation of `Iterator::find`
63   --> $DIR/manual_find_fixable.rs:68:5
64    |
65 LL | /     for el in arr {
66 LL | |         if f(el) == 20 {
67 LL | |             return Some(el);
68 LL | |         }
69 LL | |     }
70 LL | |     None
71    | |________^ help: replace with an iterator: `arr.into_iter().find(|&el| f(el) == 20)`
72
73 error: manual implementation of `Iterator::find`
74   --> $DIR/manual_find_fixable.rs:78:5
75    |
76 LL | /     for &el in arr.values() {
77 LL | |         if f(el) {
78 LL | |             return Some(el);
79 LL | |         }
80 LL | |     }
81 LL | |     None
82    | |________^ help: replace with an iterator: `arr.values().find(|&&el| f(el)).copied()`
83
84 error: manual implementation of `Iterator::find`
85   --> $DIR/manual_find_fixable.rs:87:5
86    |
87 LL | /     for el in arr {
88 LL | |         if el.is_true {
89 LL | |             return Some(el);
90 LL | |         }
91 LL | |     }
92 LL | |     None
93    | |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.is_true)`
94    |
95    = note: you may need to dereference some variables
96
97 error: manual implementation of `Iterator::find`
98   --> $DIR/manual_find_fixable.rs:117:5
99    |
100 LL | /     for (_, &x) in v {
101 LL | |         if x > 10 {
102 LL | |             return Some(x);
103 LL | |         }
104 LL | |     }
105 LL | |     None
106    | |________^ help: replace with an iterator: `v.into_iter().map(|(_, &x)| x).find(|&x| x > 10)`
107
108 error: manual implementation of `Iterator::find`
109   --> $DIR/manual_find_fixable.rs:126:5
110    |
111 LL | /     for &(_, &x) in v {
112 LL | |         if x > 10 {
113 LL | |             return Some(x);
114 LL | |         }
115 LL | |     }
116 LL | |     None
117    | |________^ help: replace with an iterator: `v.iter().map(|&(_, &x)| x).find(|&x| x > 10)`
118
119 error: manual implementation of `Iterator::find`
120   --> $DIR/manual_find_fixable.rs:135:5
121    |
122 LL | /     for x in arr {
123 LL | |         if x >= 5 {
124 LL | |             return Some(x);
125 LL | |         }
126 LL | |     }
127 LL | |     return None;
128    | |________________^ help: replace with an iterator: `arr.into_iter().find(|&x| x >= 5)`
129
130 error: manual implementation of `Iterator::find`
131   --> $DIR/manual_find_fixable.rs:190:9
132    |
133 LL | /         for x in arr {
134 LL | |             if x < 1 {
135 LL | |                 return Some(x);
136 LL | |             }
137 LL | |         }
138 LL | |         None
139    | |____________^ help: replace with an iterator: `arr.into_iter().find(|&x| x < 1)`
140
141 error: aborting due to 12 previous errors
142