11error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
2- --> $DIR/map_unwrap_or.rs:17:13
3- |
4- LL | let _ = opt.map(|x| x + 1)
5- | _____________^
6- LL | | // Should lint even though this call is on a separate line.
7- LL | | .unwrap_or(0);
8- | |_____________________^
9- |
10- = note: `-D clippy::map-unwrap-or` implied by `-D warnings`
11- help: use `map_or(<a>, <f>)` instead
12- |
13- LL | let _ = opt.map_or(0, |x| x + 1);
14- | ^^^^^^ ^^ --
15-
16- error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
17- --> $DIR/map_unwrap_or.rs:21:13
2+ --> $DIR/map_unwrap_or.rs:16:13
183 |
194LL | let _ = opt.map(|x| {
205 | _____________^
@@ -23,6 +8,7 @@ LL | | }
238LL | | ).unwrap_or(0);
249 | |__________________^
2510 |
11+ = note: `-D clippy::map-unwrap-or` implied by `-D warnings`
2612help: use `map_or(<a>, <f>)` instead
2713 |
2814LL | let _ = opt.map_or(0, |x| {
@@ -32,7 +18,7 @@ LL | );
3218 |
3319
3420error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
35- --> $DIR/map_unwrap_or.rs:25 :13
21+ --> $DIR/map_unwrap_or.rs:20 :13
3622 |
3723LL | let _ = opt.map(|x| x + 1)
3824 | _____________^
@@ -49,7 +35,7 @@ LL | }, |x| x + 1);
4935 |
5036
5137error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
52- --> $DIR/map_unwrap_or.rs:30 :13
38+ --> $DIR/map_unwrap_or.rs:25 :13
5339 |
5440LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
5541 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +46,7 @@ LL | let _ = opt.and_then(|x| Some(x + 1));
6046 | ^^^^^^^^ --
6147
6248error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
63- --> $DIR/map_unwrap_or.rs:32 :13
49+ --> $DIR/map_unwrap_or.rs:27 :13
6450 |
6551LL | let _ = opt.map(|x| {
6652 | _____________^
@@ -78,7 +64,7 @@ LL | );
7864 |
7965
8066error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
81- --> $DIR/map_unwrap_or.rs:36 :13
67+ --> $DIR/map_unwrap_or.rs:31 :13
8268 |
8369LL | let _ = opt
8470 | _____________^
@@ -92,7 +78,7 @@ LL | .and_then(|x| Some(x + 1));
9278 | ^^^^^^^^ --
9379
9480error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
95- --> $DIR/map_unwrap_or.rs:47 :13
81+ --> $DIR/map_unwrap_or.rs:42 :13
9682 |
9783LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
9884 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -103,16 +89,7 @@ LL | let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
10389 | ^^^^^^ ^^^ --
10490
10591error: 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
106- --> $DIR/map_unwrap_or.rs:51:13
107- |
108- LL | let _ = opt.map(|x| x + 1)
109- | _____________^
110- LL | | // Should lint even though this call is on a separate line.
111- LL | | .unwrap_or_else(|| 0);
112- | |_____________________________^ help: try this: `opt.map_or_else(|| 0, |x| x + 1)`
113-
114- 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
115- --> $DIR/map_unwrap_or.rs:55:13
92+ --> $DIR/map_unwrap_or.rs:46:13
11693 |
11794LL | let _ = opt.map(|x| {
11895 | _____________^
@@ -122,7 +99,7 @@ LL | | ).unwrap_or_else(|| 0);
12299 | |__________________________^
123100
124101error: 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
125- --> $DIR/map_unwrap_or.rs:59 :13
102+ --> $DIR/map_unwrap_or.rs:50 :13
126103 |
127104LL | let _ = opt.map(|x| x + 1)
128105 | _____________^
@@ -131,23 +108,5 @@ LL | | 0
131108LL | | );
132109 | |_________^
133110
134- error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
135- --> $DIR/map_unwrap_or.rs:88:13
136- |
137- LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
138- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `res.map_or_else(|e| 0, |x| x + 1)`
139-
140- error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
141- --> $DIR/map_unwrap_or.rs:90:13
142- |
143- LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
144- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `res.map_or_else(|e| 0, |x| x + 1)`
145-
146- error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
147- --> $DIR/map_unwrap_or.rs:91:13
148- |
149- LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
150- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `res.map_or_else(|e| 0, |x| x + 1)`
151-
152- error: aborting due to 13 previous errors
111+ error: aborting due to 8 previous errors
153112
0 commit comments