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