38d4ac7cea
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
204 lines
5.9 KiB
Plaintext
204 lines
5.9 KiB
Plaintext
error: this boolean expression contains a logic bug
|
|
--> $DIR/booleans.rs:10:13
|
|
|
|
|
LL | 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:10:18
|
|
|
|
|
LL | let _ = a && b || a;
|
|
| ^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:12:13
|
|
|
|
|
LL | let _ = !true;
|
|
| ^^^^^ help: try: `false`
|
|
|
|
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:13:13
|
|
|
|
|
LL | let _ = !false;
|
|
| ^^^^^^ help: try: `true`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:14:13
|
|
|
|
|
LL | let _ = !!a;
|
|
| ^^^ help: try: `a`
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/booleans.rs:15:13
|
|
|
|
|
LL | 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:15:22
|
|
|
|
|
LL | let _ = false && a;
|
|
| ^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:16:13
|
|
|
|
|
LL | let _ = false || a;
|
|
| ^^^^^^^^^^ help: try: `a`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:21:13
|
|
|
|
|
LL | let _ = !(!a && b);
|
|
| ^^^^^^^^^^ help: try: `!b || a`
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/booleans.rs:31:13
|
|
|
|
|
LL | 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:31:13
|
|
|
|
|
LL | let _ = a == b && a != b;
|
|
| ^^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:32:13
|
|
|
|
|
LL | let _ = a == b && c == 5 && a == b;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
help: try
|
|
|
|
|
LL | let _ = a == b && c == 5;
|
|
| ^^^^^^^^^^^^^^^^
|
|
LL | let _ = !(c != 5 || a != b);
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:33:13
|
|
|
|
|
LL | let _ = a == b && c == 5 && b == a;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
help: try
|
|
|
|
|
LL | let _ = a == b && c == 5;
|
|
| ^^^^^^^^^^^^^^^^
|
|
LL | let _ = !(c != 5 || a != b);
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/booleans.rs:34:13
|
|
|
|
|
LL | 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:34:13
|
|
|
|
|
LL | let _ = a < b && a >= b;
|
|
| ^^^^^
|
|
|
|
error: this boolean expression contains a logic bug
|
|
--> $DIR/booleans.rs:35:13
|
|
|
|
|
LL | 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:35:13
|
|
|
|
|
LL | let _ = a > b && a <= b;
|
|
| ^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:37:13
|
|
|
|
|
LL | let _ = a != b || !(a != b || c == d);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
help: try
|
|
|
|
|
LL | let _ = c != d || a != b;
|
|
| ^^^^^^^^^^^^^^^^
|
|
LL | let _ = !(a == b && c == d);
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:45:13
|
|
|
|
|
LL | let _ = !a.is_some();
|
|
| ^^^^^^^^^^^^ help: try: `a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:47:13
|
|
|
|
|
LL | let _ = !a.is_none();
|
|
| ^^^^^^^^^^^^ help: try: `a.is_some()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:49:13
|
|
|
|
|
LL | let _ = !b.is_err();
|
|
| ^^^^^^^^^^^ help: try: `b.is_ok()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:51:13
|
|
|
|
|
LL | let _ = !b.is_ok();
|
|
| ^^^^^^^^^^ help: try: `b.is_err()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:53:13
|
|
|
|
|
LL | let _ = !(a.is_some() && !c);
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:54:13
|
|
|
|
|
LL | let _ = !(!c ^ c) || !a.is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:55:13
|
|
|
|
|
LL | let _ = (!c ^ c) || !a.is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:56:13
|
|
|
|
|
LL | let _ = !c ^ c || !a.is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:128:8
|
|
|
|
|
LL | if !res.is_ok() {}
|
|
| ^^^^^^^^^^^^ help: try: `res.is_err()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:129:8
|
|
|
|
|
LL | if !res.is_err() {}
|
|
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:132:8
|
|
|
|
|
LL | if !res.is_some() {}
|
|
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
|
|
|
|
error: this boolean expression can be simplified
|
|
--> $DIR/booleans.rs:133:8
|
|
|
|
|
LL | if !res.is_none() {}
|
|
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`
|
|
|
|
error: aborting due to 25 previous errors
|
|
|