mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
26 lines
930 B
Plaintext
26 lines
930 B
Plaintext
error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
|
|
--> $DIR/option_map_or_none.rs:8:13
|
|
|
|
|
LL | let _ = opt.map_or(None, |x| Some(x + 1));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
|
|
--> $DIR/option_map_or_none.rs:11:13
|
|
|
|
|
LL | let _ = opt.map_or(None, |x| {
|
|
| _____________^
|
|
LL | | Some(x + 1)
|
|
LL | | });
|
|
| |_________________________^
|
|
help: try using and_then instead
|
|
|
|
|
LL | let _ = opt.and_then(|x| {
|
|
LL | Some(x + 1)
|
|
LL | });
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|