fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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