2020-01-06 06:36:33 +00:00
|
|
|
error: called `map(f).unwrap_or(a)` on an `Option` value. This can be done more directly by calling `map_or(a, f)` instead
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:17:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| x + 1)
|
|
|
|
| _____________^
|
|
|
|
LL | | // Should lint even though this call is on a separate line.
|
|
|
|
LL | | .unwrap_or(0);
|
|
|
|
| |_____________________^
|
|
|
|
|
|
2020-05-17 15:36:26 +00:00
|
|
|
= note: `-D clippy::map-unwrap-or` implied by `-D warnings`
|
2019-10-05 12:23:52 +00:00
|
|
|
help: use `map_or(a, f)` instead
|
|
|
|
|
|
|
|
|
LL | let _ = opt.map_or(0, |x| x + 1);
|
|
|
|
| ^^^^^^ ^^ --
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: called `map(f).unwrap_or(a)` on an `Option` value. This can be done more directly by calling `map_or(a, f)` instead
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:21:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| {
|
|
|
|
| _____________^
|
|
|
|
LL | | x + 1
|
|
|
|
LL | | }
|
|
|
|
LL | | ).unwrap_or(0);
|
|
|
|
| |__________________^
|
|
|
|
|
|
|
|
|
help: use `map_or(a, f)` instead
|
|
|
|
|
|
|
|
|
LL | let _ = opt.map_or(0, |x| {
|
|
|
|
LL | x + 1
|
|
|
|
LL | }
|
|
|
|
LL | );
|
|
|
|
|
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: called `map(f).unwrap_or(a)` on an `Option` value. This can be done more directly by calling `map_or(a, f)` instead
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:25:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| x + 1)
|
|
|
|
| _____________^
|
|
|
|
LL | | .unwrap_or({
|
|
|
|
LL | | 0
|
|
|
|
LL | | });
|
|
|
|
| |__________^
|
|
|
|
|
|
|
|
|
help: use `map_or(a, f)` instead
|
|
|
|
|
|
|
|
|
LL | let _ = opt.map_or({
|
|
|
|
LL | 0
|
|
|
|
LL | }, |x| x + 1);
|
|
|
|
|
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: called `map(f).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(f)` instead
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:30:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: use `and_then(f)` instead
|
|
|
|
|
|
|
|
|
LL | let _ = opt.and_then(|x| Some(x + 1));
|
|
|
|
| ^^^^^^^^ --
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: called `map(f).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(f)` instead
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:32:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| {
|
|
|
|
| _____________^
|
|
|
|
LL | | Some(x + 1)
|
|
|
|
LL | | }
|
|
|
|
LL | | ).unwrap_or(None);
|
|
|
|
| |_____________________^
|
|
|
|
|
|
|
|
|
help: use `and_then(f)` instead
|
|
|
|
|
|
|
|
|
LL | let _ = opt.and_then(|x| {
|
|
|
|
LL | Some(x + 1)
|
|
|
|
LL | }
|
|
|
|
LL | );
|
|
|
|
|
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: called `map(f).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(f)` instead
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:36:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt
|
|
|
|
| _____________^
|
|
|
|
LL | | .map(|x| Some(x + 1))
|
|
|
|
LL | | .unwrap_or(None);
|
|
|
|
| |________________________^
|
|
|
|
|
|
|
|
|
help: use `and_then(f)` instead
|
|
|
|
|
|
|
|
|
LL | .and_then(|x| Some(x + 1));
|
|
|
|
| ^^^^^^^^ --
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
error: called `map(f).unwrap_or(a)` on an `Option` value. This can be done more directly by calling `map_or(a, f)` instead
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:47:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: use `map_or(a, f)` instead
|
|
|
|
|
|
|
|
|
LL | let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
|
|
|
|
| ^^^^^^ ^^^ --
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
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
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:51:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| x + 1)
|
|
|
|
| _____________^
|
|
|
|
LL | | // Should lint even though this call is on a separate line.
|
|
|
|
LL | | .unwrap_or_else(|| 0);
|
|
|
|
| |_____________________________^
|
|
|
|
|
|
|
|
|
= note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
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
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:55:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| {
|
|
|
|
| _____________^
|
|
|
|
LL | | x + 1
|
|
|
|
LL | | }
|
|
|
|
LL | | ).unwrap_or_else(|| 0);
|
|
|
|
| |__________________________^
|
|
|
|
|
2020-01-06 06:36:33 +00:00
|
|
|
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
|
2020-05-17 15:36:26 +00:00
|
|
|
--> $DIR/map_unwrap_or.rs:59:13
|
2019-10-05 12:23:52 +00:00
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| x + 1)
|
|
|
|
| _____________^
|
|
|
|
LL | | .unwrap_or_else(||
|
|
|
|
LL | | 0
|
|
|
|
LL | | );
|
|
|
|
| |_________^
|
|
|
|
|
2020-05-17 15:36:26 +00:00
|
|
|
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
|
|
|
|
--> $DIR/map_unwrap_or.rs:88:13
|
|
|
|
|
|
|
|
|
LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `map_or_else(|e| 0, |x| x + 1)`
|
|
|
|
|
|
|
|
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
|
|
|
|
--> $DIR/map_unwrap_or.rs:90:13
|
|
|
|
|
|
|
|
|
LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `map_or_else(|e| 0, |x| x + 1)`
|
|
|
|
|
|
|
|
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
|
|
|
|
--> $DIR/map_unwrap_or.rs:91:13
|
|
|
|
|
|
|
|
|
LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `map_or_else(|e| 0, |x| x + 1)`
|
|
|
|
|
|
|
|
error: aborting due to 13 previous errors
|
2019-10-05 12:23:52 +00:00
|
|
|
|