@@ -4,8 +4,7 @@ error: manual implementation of `Iterator::find`
4
4
LL | / for &v in ARRAY {
5
5
LL | | if v == n {
6
6
LL | | return Some(v);
7
- LL | | }
8
- LL | | }
7
+ ... |
9
8
LL | | None
10
9
| |________^ help: replace with an iterator: `ARRAY.iter().find(|&&v| v == n).copied()`
11
10
|
@@ -18,8 +17,7 @@ error: manual implementation of `Iterator::find`
18
17
LL | / for (a, _) in arr {
19
18
LL | | if a % 2 == 0 {
20
19
LL | | return Some(a);
21
- LL | | }
22
- LL | | }
20
+ ... |
23
21
LL | | None
24
22
| |________^ help: replace with an iterator: `arr.into_iter().map(|(a, _)| a).find(|&a| a % 2 == 0)`
25
23
@@ -29,8 +27,7 @@ error: manual implementation of `Iterator::find`
29
27
LL | / for el in arr {
30
28
LL | | if el.name.len() == 10 {
31
29
LL | | return Some(el);
32
- LL | | }
33
- LL | | }
30
+ ... |
34
31
LL | | None
35
32
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.name.len() == 10)`
36
33
|
@@ -42,8 +39,7 @@ error: manual implementation of `Iterator::find`
42
39
LL | / for Tuple(a, _) in arr {
43
40
LL | | if a >= 3 {
44
41
LL | | return Some(a);
45
- LL | | }
46
- LL | | }
42
+ ... |
47
43
LL | | None
48
44
| |________^ help: replace with an iterator: `arr.into_iter().map(|Tuple(a, _)| a).find(|&a| a >= 3)`
49
45
@@ -53,8 +49,7 @@ error: manual implementation of `Iterator::find`
53
49
LL | / for el in arr {
54
50
LL | | if el.should_keep() {
55
51
LL | | return Some(el);
56
- LL | | }
57
- LL | | }
52
+ ... |
58
53
LL | | None
59
54
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.should_keep())`
60
55
|
@@ -66,8 +61,7 @@ error: manual implementation of `Iterator::find`
66
61
LL | / for el in arr {
67
62
LL | | if f(el) == 20 {
68
63
LL | | return Some(el);
69
- LL | | }
70
- LL | | }
64
+ ... |
71
65
LL | | None
72
66
| |________^ help: replace with an iterator: `arr.into_iter().find(|&el| f(el) == 20)`
73
67
@@ -77,8 +71,7 @@ error: manual implementation of `Iterator::find`
77
71
LL | / for &el in arr.values() {
78
72
LL | | if f(el) {
79
73
LL | | return Some(el);
80
- LL | | }
81
- LL | | }
74
+ ... |
82
75
LL | | None
83
76
| |________^ help: replace with an iterator: `arr.values().find(|&&el| f(el)).copied()`
84
77
@@ -88,8 +81,7 @@ error: manual implementation of `Iterator::find`
88
81
LL | / for el in arr {
89
82
LL | | if el.is_true {
90
83
LL | | return Some(el);
91
- LL | | }
92
- LL | | }
84
+ ... |
93
85
LL | | None
94
86
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.is_true)`
95
87
|
@@ -101,8 +93,7 @@ error: manual implementation of `Iterator::find`
101
93
LL | / for (_, &x) in v {
102
94
LL | | if x > 10 {
103
95
LL | | return Some(x);
104
- LL | | }
105
- LL | | }
96
+ ... |
106
97
LL | | None
107
98
| |________^ help: replace with an iterator: `v.into_iter().map(|(_, &x)| x).find(|&x| x > 10)`
108
99
@@ -112,8 +103,7 @@ error: manual implementation of `Iterator::find`
112
103
LL | / for &(_, &x) in v {
113
104
LL | | if x > 10 {
114
105
LL | | return Some(x);
115
- LL | | }
116
- LL | | }
106
+ ... |
117
107
LL | | None
118
108
| |________^ help: replace with an iterator: `v.iter().map(|&(_, &x)| x).find(|&x| x > 10)`
119
109
@@ -123,8 +113,7 @@ error: manual implementation of `Iterator::find`
123
113
LL | / for x in arr {
124
114
LL | | if x >= 5 {
125
115
LL | | return Some(x);
126
- LL | | }
127
- LL | | }
116
+ ... |
128
117
LL | | return None;
129
118
| |________________^ help: replace with an iterator: `arr.into_iter().find(|&x| x >= 5)`
130
119
@@ -134,8 +123,7 @@ error: manual implementation of `Iterator::find`
134
123
LL | / for x in arr {
135
124
LL | | if x < 1 {
136
125
LL | | return Some(x);
137
- LL | | }
138
- LL | | }
126
+ ... |
139
127
LL | | None
140
128
| |____________^ help: replace with an iterator: `arr.into_iter().find(|&x| x < 1)`
141
129
0 commit comments