mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 00:47:16 +00:00
203 lines
5.9 KiB
Text
203 lines
5.9 KiB
Text
error: this boolean expression contains a logic bug
|
|
--> $DIR/booleans.rs:12:13
|
|
|
|
|
12 | let _ = a && b || a;
|
|
| ^^^^^^^^^^^ help: it would look like the following: `a`
|
|
|
|
|
= note: `-D clippy::logic-bug` implied by `-D warnings`
|
|
help: this expression can be optimized out by applying boolean operations to the outer expression
|
|
--> $DIR/booleans.rs:12:18
|
|
|
|
|
12 | let _ = a && b || a;
|
|
| ^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:14:13
|
|
|
|
|
14 | let _ = !true;
|
|
| ^^^^^ help: try: `false`
|
|
|
|
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:15:13
|
|
|
|
|
15 | let _ = !false;
|
|
| ^^^^^^ help: try: `true`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:16:13
|
|
|
|
|
16 | let _ = !!a;
|
|
| ^^^ help: try: `a`
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/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
|
|
--> $DIR/booleans.rs:17:22
|
|
|
|
|
17 | let _ = false && a;
|
|
| ^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:18:13
|
|
|
|
|
18 | let _ = false || a;
|
|
| ^^^^^^^^^^ help: try: `a`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:23:13
|
|
|
|
|
23 | let _ = !(!a && b);
|
|
| ^^^^^^^^^^ help: try: `!b || a`
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/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
|
|
--> $DIR/booleans.rs:33:13
|
|
|
|
|
33 | let _ = a == b && a != b;
|
|
| ^^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:34:13
|
|
|
|
|
34 | let _ = a == b && c == 5 && a == b;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
help: try
|
|
|
|
|
34 | let _ = a == b && c == 5;
|
|
| ^^^^^^^^^^^^^^^^
|
|
34 | let _ = !(c != 5 || a != b);
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:35:13
|
|
|
|
|
35 | let _ = a == b && c == 5 && b == a;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
help: try
|
|
|
|
|
35 | let _ = a == b && c == 5;
|
|
| ^^^^^^^^^^^^^^^^
|
|
35 | let _ = !(c != 5 || a != b);
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/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
|
|
--> $DIR/booleans.rs:36:13
|
|
|
|
|
36 | let _ = a < b && a >= b;
|
|
| ^^^^^
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/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
|
|
--> $DIR/booleans.rs:37:13
|
|
|
|
|
37 | let _ = a > b && a <= b;
|
|
| ^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:39:13
|
|
|
|
|
39 | let _ = a != b || !(a != b || c == d);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
help: try
|
|
|
|
|
39 | let _ = c != d || a != b;
|
|
| ^^^^^^^^^^^^^^^^
|
|
39 | let _ = !(a == b && c == d);
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:47:13
|
|
|
|
|
47 | let _ = !a.is_some();
|
|
| ^^^^^^^^^^^^ help: try: `a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:49:13
|
|
|
|
|
49 | let _ = !a.is_none();
|
|
| ^^^^^^^^^^^^ help: try: `a.is_some()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:51:13
|
|
|
|
|
51 | let _ = !b.is_err();
|
|
| ^^^^^^^^^^^ help: try: `b.is_ok()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:53:13
|
|
|
|
|
53 | let _ = !b.is_ok();
|
|
| ^^^^^^^^^^ help: try: `b.is_err()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:55:13
|
|
|
|
|
55 | let _ = !(a.is_some() && !c);
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:56:13
|
|
|
|
|
56 | let _ = !(!c ^ c) || !a.is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:57:13
|
|
|
|
|
57 | let _ = (!c ^ c) || !a.is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:58:13
|
|
|
|
|
58 | let _ = !c ^ c || !a.is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:110:8
|
|
|
|
|
110 | if !res.is_ok() { }
|
|
| ^^^^^^^^^^^^ help: try: `res.is_err()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:111:8
|
|
|
|
|
111 | if !res.is_err() { }
|
|
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:114:8
|
|
|
|
|
114 | if !res.is_some() { }
|
|
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:115:8
|
|
|
|
|
115 | if !res.is_none() { }
|
|
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`
|
|
|
|
error: aborting due to 25 previous errors
|
|
|