mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-30 06:53:27 +00:00
127 lines
3.5 KiB
Text
127 lines
3.5 KiB
Text
error: this boolean expression contains a logic bug
|
|
--> booleans.rs:12:13
|
|
|
|
|
12 | let _ = a && b || a;
|
|
| ^^^^^^^^^^^ help: it would look like the following `a`
|
|
|
|
|
= note: `-D logic-bug` implied by `-D warnings`
|
|
help: this expression can be optimized out by applying boolean operations to the outer expression
|
|
--> booleans.rs:12:18
|
|
|
|
|
12 | let _ = a && b || a;
|
|
| ^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:14:13
|
|
|
|
|
14 | let _ = !true;
|
|
| ^^^^^ help: try `false`
|
|
|
|
|
= note: `-D nonminimal-bool` implied by `-D warnings`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:15:13
|
|
|
|
|
15 | let _ = !false;
|
|
| ^^^^^^ help: try `true`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:16:13
|
|
|
|
|
16 | let _ = !!a;
|
|
| ^^^ help: try `a`
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> booleans.rs:17:13
|
|
|
|
|
17 | let _ = false && a;
|
|
| ^^^^^^^^^^ help: it would look like the following `false`
|
|
|
|
|
help: this expression can be optimized out by applying boolean operations to the outer expression
|
|
--> booleans.rs:17:22
|
|
|
|
|
17 | let _ = false && a;
|
|
| ^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:18:13
|
|
|
|
|
18 | let _ = false || a;
|
|
| ^^^^^^^^^^ help: try `a`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:23:13
|
|
|
|
|
23 | let _ = !(!a && b);
|
|
| ^^^^^^^^^^ help: try `!b || a`
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> booleans.rs:33:13
|
|
|
|
|
33 | let _ = a == b && a != b;
|
|
| ^^^^^^^^^^^^^^^^ help: it would look like the following `false`
|
|
|
|
|
help: this expression can be optimized out by applying boolean operations to the outer expression
|
|
--> booleans.rs:33:13
|
|
|
|
|
33 | let _ = a == b && a != b;
|
|
| ^^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:34:13
|
|
|
|
|
34 | let _ = a == b && c == 5 && a == b;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try
|
|
| let _ = a == b && c == 5;
|
|
| let _ = !(c != 5 || a != b);
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:35:13
|
|
|
|
|
35 | let _ = a == b && c == 5 && b == a;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try
|
|
| let _ = a == b && c == 5;
|
|
| let _ = !(c != 5 || a != b);
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> booleans.rs:36:13
|
|
|
|
|
36 | let _ = a < b && a >= b;
|
|
| ^^^^^^^^^^^^^^^ help: it would look like the following `false`
|
|
|
|
|
help: this expression can be optimized out by applying boolean operations to the outer expression
|
|
--> booleans.rs:36:13
|
|
|
|
|
36 | let _ = a < b && a >= b;
|
|
| ^^^^^
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> booleans.rs:37:13
|
|
|
|
|
37 | let _ = a > b && a <= b;
|
|
| ^^^^^^^^^^^^^^^ help: it would look like the following `false`
|
|
|
|
|
help: this expression can be optimized out by applying boolean operations to the outer expression
|
|
--> booleans.rs:37:13
|
|
|
|
|
37 | let _ = a > b && a <= b;
|
|
| ^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> booleans.rs:39:13
|
|
|
|
|
39 | let _ = a != b || !(a != b || c == d);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try
|
|
| let _ = c != d || a != b;
|
|
| let _ = !(a == b && c == d);
|
|
|
|
error: aborting due to 13 previous errors
|
|
|
|
|
|
To learn more, run the command again with --verbose.
|