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