2021-03-06 11:08:46 -06:00
|
|
|
error: this could be simplified with `bool::then`
|
2021-03-08 07:52:03 -06:00
|
|
|
--> $DIR/if_then_some_else_none.rs:6:13
|
2021-03-06 11:08:46 -06:00
|
|
|
|
|
|
|
|
LL | let _ = if foo() {
|
|
|
|
| _____________^
|
|
|
|
LL | | println!("true!");
|
|
|
|
LL | | Some("foo")
|
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
2021-03-08 08:19:57 -06:00
|
|
|
| |_____^
|
2021-03-06 11:08:46 -06:00
|
|
|
|
|
|
|
|
= note: `-D clippy::if-then-some-else-none` implied by `-D warnings`
|
2021-03-08 08:19:57 -06:00
|
|
|
= help: consider using `bool::then` like: `foo().then(|| { /* snippet */ "foo" })`
|
2021-03-06 11:08:46 -06:00
|
|
|
|
2021-03-08 07:52:03 -06:00
|
|
|
error: this could be simplified with `bool::then`
|
|
|
|
--> $DIR/if_then_some_else_none.rs:66:13
|
|
|
|
|
|
|
|
|
LL | let _ = if foo() {
|
|
|
|
| _____________^
|
|
|
|
LL | | println!("true!");
|
2021-03-08 08:19:57 -06:00
|
|
|
LL | | Some(150)
|
2021-03-08 07:52:03 -06:00
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
2021-03-08 08:19:57 -06:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= help: consider using `bool::then` like: `foo().then(|| { /* snippet */ 150 })`
|
2021-03-08 07:52:03 -06:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
2021-03-06 11:08:46 -06:00
|
|
|
|