@@ -18,109 +18,8 @@ LL | | }
1818 |
1919 = note: `-D clippy::new-ret-no-self` implied by `-D warnings`
2020
21- error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
22- --> $DIR/methods.rs:176:13
23- |
24- LL | let _ = opt.map(|x| x + 1)
25- | _____________^
26- LL | | // Should lint even though this call is on a separate line.
27- LL | | .unwrap_or(0);
28- | |____________________________^
29- |
30- = note: `-D clippy::option-map-unwrap-or` implied by `-D warnings`
31- = note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
32-
33- error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
34- --> $DIR/methods.rs:180:13
35- |
36- LL | let _ = opt.map(|x| {
37- | _____________^
38- LL | | x + 1
39- LL | | }
40- LL | | ).unwrap_or(0);
41- | |____________________________^
42-
43- error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
44- --> $DIR/methods.rs:184:13
45- |
46- LL | let _ = opt.map(|x| x + 1)
47- | _____________^
48- LL | | .unwrap_or({
49- LL | | 0
50- LL | | });
51- | |__________________^
52-
53- error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
54- --> $DIR/methods.rs:189:13
55- |
56- LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
57- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58- |
59- = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
60-
61- error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
62- --> $DIR/methods.rs:191:13
63- |
64- LL | let _ = opt.map(|x| {
65- | _____________^
66- LL | | Some(x + 1)
67- LL | | }
68- LL | | ).unwrap_or(None);
69- | |_____________________^
70-
71- error: called `map(f).unwrap_or(None)` on an Option value. This can be done more directly by calling `and_then(f)` instead
72- --> $DIR/methods.rs:195:13
73- |
74- LL | let _ = opt
75- | _____________^
76- LL | | .map(|x| Some(x + 1))
77- LL | | .unwrap_or(None);
78- | |________________________^
79- |
80- = note: replace `map(|x| Some(x + 1)).unwrap_or(None)` with `and_then(|x| Some(x + 1))`
81-
82- error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
83- --> $DIR/methods.rs:206:13
84- |
85- LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
86- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87- |
88- = note: replace `map(|p| format!("{}.", p)).unwrap_or(id)` with `map_or(id, |p| format!("{}.", p))`
89-
90- error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
91- --> $DIR/methods.rs:210:13
92- |
93- LL | let _ = opt.map(|x| x + 1)
94- | _____________^
95- LL | | // Should lint even though this call is on a separate line.
96- LL | | .unwrap_or_else(|| 0);
97- | |____________________________________^
98- |
99- = note: `-D clippy::option-map-unwrap-or-else` implied by `-D warnings`
100- = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
101-
102- error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
103- --> $DIR/methods.rs:214:13
104- |
105- LL | let _ = opt.map(|x| {
106- | _____________^
107- LL | | x + 1
108- LL | | }
109- LL | | ).unwrap_or_else(|| 0);
110- | |____________________________________^
111-
112- error: called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling `map_or_else(g, f)` instead
113- --> $DIR/methods.rs:218:13
114- |
115- LL | let _ = opt.map(|x| x + 1)
116- | _____________^
117- LL | | .unwrap_or_else(||
118- LL | | 0
119- LL | | );
120- | |_________________^
121-
12221error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
123- --> $DIR/methods.rs:248 :13
22+ --> $DIR/methods.rs:173 :13
12423 |
12524LL | let _ = v.iter().filter(|&x| *x < 0).next();
12625 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -129,7 +28,7 @@ LL | let _ = v.iter().filter(|&x| *x < 0).next();
12928 = note: replace `filter(|&x| *x < 0).next()` with `find(|&x| *x < 0)`
13029
13130error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
132- --> $DIR/methods.rs:251 :13
31+ --> $DIR/methods.rs:176 :13
13332 |
13433LL | let _ = v.iter().filter(|&x| {
13534 | _____________^
@@ -139,33 +38,33 @@ LL | | ).next();
13938 | |___________________________^
14039
14140error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
142- --> $DIR/methods.rs:268 :22
41+ --> $DIR/methods.rs:193 :22
14342 |
14443LL | let _ = v.iter().find(|&x| *x < 0).is_some();
14544 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| *x < 0)`
14645 |
14746 = note: `-D clippy::search-is-some` implied by `-D warnings`
14847
14948error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
150- --> $DIR/methods.rs:269 :20
49+ --> $DIR/methods.rs:194 :20
15150 |
15251LL | let _ = (0..1).find(|x| **y == *x).is_some(); // one dereference less
15352 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| **y == x)`
15453
15554error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
156- --> $DIR/methods.rs:270 :20
55+ --> $DIR/methods.rs:195 :20
15756 |
15857LL | let _ = (0..1).find(|x| *x == 0).is_some();
15958 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| x == 0)`
16059
16160error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
162- --> $DIR/methods.rs:271 :22
61+ --> $DIR/methods.rs:196 :22
16362 |
16463LL | let _ = v.iter().find(|x| **x == 0).is_some();
16564 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|x| *x == 0)`
16665
16766error: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`.
168- --> $DIR/methods.rs:274 :13
67+ --> $DIR/methods.rs:199 :13
16968 |
17069LL | let _ = v.iter().find(|&x| {
17170 | _____________^
@@ -175,13 +74,13 @@ LL | | ).is_some();
17574 | |______________________________^
17675
17776error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
178- --> $DIR/methods.rs:280 :22
77+ --> $DIR/methods.rs:205 :22
17978 |
18079LL | let _ = v.iter().position(|&x| x < 0).is_some();
18180 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|&x| x < 0)`
18281
18382error: called `is_some()` after searching an `Iterator` with position. This is more succinctly expressed by calling `any()`.
184- --> $DIR/methods.rs:283 :13
83+ --> $DIR/methods.rs:208 :13
18584 |
18685LL | let _ = v.iter().position(|&x| {
18786 | _____________^
@@ -191,13 +90,13 @@ LL | | ).is_some();
19190 | |______________________________^
19291
19392error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
194- --> $DIR/methods.rs:289 :22
93+ --> $DIR/methods.rs:214 :22
19594 |
19695LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
19796 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `any(|&x| x < 0)`
19897
19998error: called `is_some()` after searching an `Iterator` with rposition. This is more succinctly expressed by calling `any()`.
200- --> $DIR/methods.rs:292 :13
99+ --> $DIR/methods.rs:217 :13
201100 |
202101LL | let _ = v.iter().rposition(|&x| {
203102 | _____________^
@@ -206,5 +105,5 @@ LL | | }
206105LL | | ).is_some();
207106 | |______________________________^
208107
209- error: aborting due to 23 previous errors
108+ error: aborting due to 13 previous errors
210109
0 commit comments