mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
20 lines
684 B
Text
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
|
|
|