rust-clippy/tests/ui/option_and_then_some.stderr
2019-08-19 03:54:40 +00:00

20 lines
684 B
Text

error: using `Option.and_then(Some)`, which is a no-op
--> $DIR/option_and_then_some.rs:8:13
|
LL | let _ = x.and_then(Some);
| ^^^^^^^^^^^^^^^^ help: use the expression directly: `x`
|
note: lint level defined here
--> $DIR/option_and_then_some.rs:2:9
|
LL | #![deny(clippy::option_and_then_some)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> $DIR/option_and_then_some.rs:9:13
|
LL | let _ = x.and_then(|o| Some(o + 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `x.map(|o| o + 1)`
error: aborting due to 2 previous errors