mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-09 22:37:34 +00:00
29 lines
788 B
Plaintext
29 lines
788 B
Plaintext
error: this could be simplified with `bool::then`
|
|
--> $DIR/if_then_some_else_none.rs:6:13
|
|
|
|
|
LL | let _ = if foo() {
|
|
| _____________^
|
|
LL | | println!("true!");
|
|
LL | | Some("foo")
|
|
LL | | } else {
|
|
LL | | None
|
|
LL | | };
|
|
| |_____^ help: try this: `foo().then(|| { /* snippet */ "foo" })`
|
|
|
|
|
= note: `-D clippy::if-then-some-else-none` implied by `-D warnings`
|
|
|
|
error: this could be simplified with `bool::then`
|
|
--> $DIR/if_then_some_else_none.rs:66:13
|
|
|
|
|
LL | let _ = if foo() {
|
|
| _____________^
|
|
LL | | println!("true!");
|
|
LL | | Some("foo")
|
|
LL | | } else {
|
|
LL | | None
|
|
LL | | };
|
|
| |_____^ help: try this: `foo().then(|| { /* snippet */ "foo" })`
|
|
|
|
error: aborting due to 2 previous errors
|
|
|