]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_bool.stderr
Merge #3368
[rust.git] / tests / ui / needless_bool.stderr
1 error: this if-then-else expression will always return true
2   --> $DIR/needless_bool.rs:41:5
3    |
4 41 |     if x { true } else { true };
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::needless-bool` implied by `-D warnings`
8
9 error: this if-then-else expression will always return false
10   --> $DIR/needless_bool.rs:42:5
11    |
12 42 |     if x { false } else { false };
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
15 error: this if-then-else expression returns a bool literal
16   --> $DIR/needless_bool.rs:43:5
17    |
18 43 |     if x { true } else { false };
19    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `x`
20
21 error: this if-then-else expression returns a bool literal
22   --> $DIR/needless_bool.rs:44:5
23    |
24 44 |     if x { false } else { true };
25    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!x`
26
27 error: this if-then-else expression returns a bool literal
28   --> $DIR/needless_bool.rs:45:5
29    |
30 45 |     if x && y { false } else { true };
31    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!(x && y)`
32
33 error: this if-then-else expression will always return true
34   --> $DIR/needless_bool.rs:60:5
35    |
36 60 |     if x { return true } else { return true };
37    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38
39 error: this if-then-else expression will always return false
40   --> $DIR/needless_bool.rs:65:5
41    |
42 65 |     if x { return false } else { return false };
43    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
45 error: this if-then-else expression returns a bool literal
46   --> $DIR/needless_bool.rs:70:5
47    |
48 70 |     if x { return true } else { return false };
49    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x`
50
51 error: this if-then-else expression returns a bool literal
52   --> $DIR/needless_bool.rs:75:5
53    |
54 75 |     if x && y { return true } else { return false };
55    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x && y`
56
57 error: this if-then-else expression returns a bool literal
58   --> $DIR/needless_bool.rs:80:5
59    |
60 80 |     if x { return false } else { return true };
61    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !x`
62
63 error: this if-then-else expression returns a bool literal
64   --> $DIR/needless_bool.rs:85:5
65    |
66 85 |     if x && y { return false } else { return true };
67    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !(x && y)`
68
69 error: equality checks against true are unnecessary
70   --> $DIR/needless_bool.rs:89:7
71    |
72 89 |    if x  == true { };
73    |       ^^^^^^^^^^ help: try simplifying it as shown: `x`
74    |
75    = note: `-D clippy::bool-comparison` implied by `-D warnings`
76
77 error: equality checks against false can be replaced by a negation
78   --> $DIR/needless_bool.rs:93:7
79    |
80 93 |    if x  == false { };
81    |       ^^^^^^^^^^^ help: try simplifying it as shown: `!x`
82
83 error: equality checks against true are unnecessary
84    --> $DIR/needless_bool.rs:104:8
85     |
86 104 |     if x == true { };
87     |        ^^^^^^^^^ help: try simplifying it as shown: `x`
88
89 error: equality checks against false can be replaced by a negation
90    --> $DIR/needless_bool.rs:105:8
91     |
92 105 |     if x == false { };
93     |        ^^^^^^^^^^ help: try simplifying it as shown: `!x`
94
95 error: aborting due to 15 previous errors
96