summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/if_then_some_else_none.stderr
blob: 8cb22d569f4cc90bca59bf68e2971bb5e8415458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 | |     };
   | |_____^
   |
   = note: `-D clippy::if-then-some-else-none` implied by `-D warnings`
   = help: consider using `bool::then` like: `foo().then(|| { /* snippet */ "foo" })`

error: this could be simplified with `bool::then`
  --> $DIR/if_then_some_else_none.rs:14:13
   |
LL |       let _ = if matches!(true, true) {
   |  _____________^
LL | |         println!("true!");
LL | |         Some(matches!(true, false))
LL | |     } else {
LL | |         None
LL | |     };
   | |_____^
   |
   = help: consider using `bool::then` like: `matches!(true, true).then(|| { /* snippet */ matches!(true, false) })`

error: this could be simplified with `bool::then`
  --> $DIR/if_then_some_else_none.rs:23:28
   |
LL |     let _ = x.and_then(|o| if o < 32 { Some(o) } else { None });
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider using `bool::then` like: `(o < 32).then(|| o)`

error: this could be simplified with `bool::then`
  --> $DIR/if_then_some_else_none.rs:27:13
   |
LL |     let _ = if !x { Some(0) } else { None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider using `bool::then` like: `(!x).then(|| 0)`

error: this could be simplified with `bool::then`
  --> $DIR/if_then_some_else_none.rs:82:13
   |
LL |       let _ = if foo() {
   |  _____________^
LL | |         println!("true!");
LL | |         Some(150)
LL | |     } else {
LL | |         None
LL | |     };
   | |_____^
   |
   = help: consider using `bool::then` like: `foo().then(|| { /* snippet */ 150 })`

error: aborting due to 5 previous errors