2020-10-26 10:02:01 +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
|
|
|
|
--> $DIR/map_unwrap_or_fixable.rs:17:13
|
|
|
|
|
|
|
|
|
LL | let _ = opt.map(|x| x + 1)
|
|
|
|
| _____________^
|
|
|
|
LL | | // Should lint even though this call is on a separate line.
|
|
|
|
LL | | .unwrap_or_else(|| 0);
|
2023-07-01 11:08:01 +00:00
|
|
|
| |_____________________________^ help: try: `opt.map_or_else(|| 0, |x| x + 1)`
|
2020-10-26 10:02:01 +00:00
|
|
|
|
|
|
|
|
= note: `-D clippy::map-unwrap-or` implied by `-D warnings`
|
|
|
|
|
|
|
|
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_fixable.rs:47:13
|
|
|
|
|
|
|
|
|
LL | let _ = res.map(|x| x + 1)
|
|
|
|
| _____________^
|
|
|
|
LL | | // should lint even though this call is on a separate line
|
|
|
|
LL | | .unwrap_or_else(|_e| 0);
|
2023-07-01 11:08:01 +00:00
|
|
|
| |_______________________________^ help: try: `res.map_or_else(|_e| 0, |x| x + 1)`
|
2020-10-26 10:02:01 +00:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|