rust/tests/ui/option_map_or_none.stderr

27 lines
948 B
Plaintext
Raw Normal View History

error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `and_then(..)` instead
--> $DIR/option_map_or_none.rs:10:13
|
LL | let _ = opt.map_or(None, |x| Some(x + 1));
2020-01-06 06:36:33 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `opt.and_then(|x| Some(x + 1))`
|
= note: `-D clippy::option-map-or-none` implied by `-D warnings`
error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `and_then(..)` instead
--> $DIR/option_map_or_none.rs:13:13
|
LL | let _ = opt.map_or(None, |x| {
| _____________^
LL | | Some(x + 1)
LL | | });
| |_________________________^
2019-10-26 19:53:42 +00:00
|
2020-01-06 06:36:33 +00:00
help: try using `and_then` instead
|
2021-08-11 14:21:33 +00:00
LL ~ let _ = opt.and_then(|x| {
LL + Some(x + 1)
LL ~ });
|
error: aborting due to 2 previous errors