@@ -53,22 +53,28 @@ error: this boolean expression can be simplified
53
53
--> $DIR/booleans.rs:21:13
54
54
|
55
55
LL | let _ = !(!a && b);
56
- | ^^^^^^^^^^ help: try: `!b || a`
56
+ | ^^^^^^^^^^ help: try: `a || !b`
57
+
58
+ error: this boolean expression can be simplified
59
+ --> $DIR/booleans.rs:22:13
60
+ |
61
+ LL | let _ = !(!a || b);
62
+ | ^^^^^^^^^^ help: try: `a && !b`
57
63
58
64
error: this boolean expression contains a logic bug
59
- --> $DIR/booleans.rs:31 :13
65
+ --> $DIR/booleans.rs:32 :13
60
66
|
61
67
LL | let _ = a == b && a != b;
62
68
| ^^^^^^^^^^^^^^^^ help: it would look like the following: `false`
63
69
|
64
70
help: this expression can be optimized out by applying boolean operations to the outer expression
65
- --> $DIR/booleans.rs:31 :13
71
+ --> $DIR/booleans.rs:32 :13
66
72
|
67
73
LL | let _ = a == b && a != b;
68
74
| ^^^^^^
69
75
70
76
error: this boolean expression can be simplified
71
- --> $DIR/booleans.rs:32 :13
77
+ --> $DIR/booleans.rs:33 :13
72
78
|
73
79
LL | let _ = a == b && c == 5 && a == b;
74
80
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -77,11 +83,24 @@ help: try
77
83
|
78
84
LL | let _ = a == b && c == 5;
79
85
| ^^^^^^^^^^^^^^^^
80
- LL | let _ = !(c != 5 || a != b );
86
+ LL | let _ = !(a != b || c != 5 );
81
87
| ^^^^^^^^^^^^^^^^^^^
82
88
83
89
error: this boolean expression can be simplified
84
- --> $DIR/booleans.rs:33:13
90
+ --> $DIR/booleans.rs:34:13
91
+ |
92
+ LL | let _ = a == b || c == 5 || a == b;
93
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
94
+ |
95
+ help: try
96
+ |
97
+ LL | let _ = a == b || c == 5;
98
+ | ^^^^^^^^^^^^^^^^
99
+ LL | let _ = !(a != b && c != 5);
100
+ | ^^^^^^^^^^^^^^^^^^^
101
+
102
+ error: this boolean expression can be simplified
103
+ --> $DIR/booleans.rs:35:13
85
104
|
86
105
LL | let _ = a == b && c == 5 && b == a;
87
106
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -90,117 +109,136 @@ help: try
90
109
|
91
110
LL | let _ = a == b && c == 5;
92
111
| ^^^^^^^^^^^^^^^^
93
- LL | let _ = !(c != 5 || a != b );
112
+ LL | let _ = !(a != b || c != 5 );
94
113
| ^^^^^^^^^^^^^^^^^^^
95
114
96
115
error: this boolean expression contains a logic bug
97
- --> $DIR/booleans.rs:34 :13
116
+ --> $DIR/booleans.rs:36 :13
98
117
|
99
118
LL | let _ = a < b && a >= b;
100
119
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
101
120
|
102
121
help: this expression can be optimized out by applying boolean operations to the outer expression
103
- --> $DIR/booleans.rs:34 :13
122
+ --> $DIR/booleans.rs:36 :13
104
123
|
105
124
LL | let _ = a < b && a >= b;
106
125
| ^^^^^
107
126
108
127
error: this boolean expression contains a logic bug
109
- --> $DIR/booleans.rs:35 :13
128
+ --> $DIR/booleans.rs:37 :13
110
129
|
111
130
LL | let _ = a > b && a <= b;
112
131
| ^^^^^^^^^^^^^^^ help: it would look like the following: `false`
113
132
|
114
133
help: this expression can be optimized out by applying boolean operations to the outer expression
115
- --> $DIR/booleans.rs:35 :13
134
+ --> $DIR/booleans.rs:37 :13
116
135
|
117
136
LL | let _ = a > b && a <= b;
118
137
| ^^^^^
119
138
120
139
error: this boolean expression can be simplified
121
- --> $DIR/booleans.rs:37 :13
140
+ --> $DIR/booleans.rs:39 :13
122
141
|
123
142
LL | let _ = a != b || !(a != b || c == d);
124
143
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125
144
|
126
145
help: try
127
146
|
128
- LL | let _ = c != d || a != b ;
147
+ LL | let _ = a != b || c != d ;
129
148
| ^^^^^^^^^^^^^^^^
130
149
LL | let _ = !(a == b && c == d);
131
150
| ^^^^^^^^^^^^^^^^^^^
132
151
133
152
error: this boolean expression can be simplified
134
- --> $DIR/booleans.rs:45:13
153
+ --> $DIR/booleans.rs:40:13
154
+ |
155
+ LL | let _ = a != b && !(a != b && c == d);
156
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157
+ |
158
+ help: try
159
+ |
160
+ LL | let _ = a != b && c != d;
161
+ | ^^^^^^^^^^^^^^^^
162
+ LL | let _ = !(a == b || c == d);
163
+ | ^^^^^^^^^^^^^^^^^^^
164
+
165
+ error: this boolean expression can be simplified
166
+ --> $DIR/booleans.rs:48:13
135
167
|
136
168
LL | let _ = !a.is_some();
137
169
| ^^^^^^^^^^^^ help: try: `a.is_none()`
138
170
139
171
error: this boolean expression can be simplified
140
- --> $DIR/booleans.rs:47 :13
172
+ --> $DIR/booleans.rs:50 :13
141
173
|
142
174
LL | let _ = !a.is_none();
143
175
| ^^^^^^^^^^^^ help: try: `a.is_some()`
144
176
145
177
error: this boolean expression can be simplified
146
- --> $DIR/booleans.rs:49 :13
178
+ --> $DIR/booleans.rs:52 :13
147
179
|
148
180
LL | let _ = !b.is_err();
149
181
| ^^^^^^^^^^^ help: try: `b.is_ok()`
150
182
151
183
error: this boolean expression can be simplified
152
- --> $DIR/booleans.rs:51 :13
184
+ --> $DIR/booleans.rs:54 :13
153
185
|
154
186
LL | let _ = !b.is_ok();
155
187
| ^^^^^^^^^^ help: try: `b.is_err()`
156
188
157
189
error: this boolean expression can be simplified
158
- --> $DIR/booleans.rs:53 :13
190
+ --> $DIR/booleans.rs:56 :13
159
191
|
160
192
LL | let _ = !(a.is_some() && !c);
161
- | ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()`
193
+ | ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() || c`
194
+
195
+ error: this boolean expression can be simplified
196
+ --> $DIR/booleans.rs:57:13
197
+ |
198
+ LL | let _ = !(a.is_some() || !c);
199
+ | ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() && c`
162
200
163
201
error: this boolean expression can be simplified
164
- --> $DIR/booleans.rs:54 :26
202
+ --> $DIR/booleans.rs:58 :26
165
203
|
166
204
LL | let _ = !(!c ^ c) || !a.is_some();
167
205
| ^^^^^^^^^^^^ help: try: `a.is_none()`
168
206
169
207
error: this boolean expression can be simplified
170
- --> $DIR/booleans.rs:55 :25
208
+ --> $DIR/booleans.rs:59 :25
171
209
|
172
210
LL | let _ = (!c ^ c) || !a.is_some();
173
211
| ^^^^^^^^^^^^ help: try: `a.is_none()`
174
212
175
213
error: this boolean expression can be simplified
176
- --> $DIR/booleans.rs:56 :23
214
+ --> $DIR/booleans.rs:60 :23
177
215
|
178
216
LL | let _ = !c ^ c || !a.is_some();
179
217
| ^^^^^^^^^^^^ help: try: `a.is_none()`
180
218
181
219
error: this boolean expression can be simplified
182
- --> $DIR/booleans.rs:128 :8
220
+ --> $DIR/booleans.rs:132 :8
183
221
|
184
222
LL | if !res.is_ok() {}
185
223
| ^^^^^^^^^^^^ help: try: `res.is_err()`
186
224
187
225
error: this boolean expression can be simplified
188
- --> $DIR/booleans.rs:129 :8
226
+ --> $DIR/booleans.rs:133 :8
189
227
|
190
228
LL | if !res.is_err() {}
191
229
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
192
230
193
231
error: this boolean expression can be simplified
194
- --> $DIR/booleans.rs:132 :8
232
+ --> $DIR/booleans.rs:136 :8
195
233
|
196
234
LL | if !res.is_some() {}
197
235
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
198
236
199
237
error: this boolean expression can be simplified
200
- --> $DIR/booleans.rs:133 :8
238
+ --> $DIR/booleans.rs:137 :8
201
239
|
202
240
LL | if !res.is_none() {}
203
241
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`
204
242
205
- error: aborting due to 25 previous errors
243
+ error: aborting due to 29 previous errors
206
244
0 commit comments