mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
8b02dac542
side effect for `enum_variants`: use .first() instead of .get(0) in enum_variants lint move to_camel_case to str_util module move module, enum and struct name repetitions check to a single file `item_name_repetitions` rename enum_variants threshold config option
195 lines
5.3 KiB
Text
195 lines
5.3 KiB
Text
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:41:5
|
|
|
|
|
LL | / if x {
|
|
LL | | true
|
|
LL | | } else {
|
|
LL | | false
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `x`
|
|
|
|
|
= note: `-D clippy::needless-bool` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::needless_bool)]`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:46:5
|
|
|
|
|
LL | / if x {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `!x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:51:5
|
|
|
|
|
LL | / if x && y {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `!(x && y)`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:59:5
|
|
|
|
|
LL | / if a == b {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `a != b`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:64:5
|
|
|
|
|
LL | / if a != b {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `a == b`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:69:5
|
|
|
|
|
LL | / if a < b {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `a >= b`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:74:5
|
|
|
|
|
LL | / if a <= b {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `a > b`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:79:5
|
|
|
|
|
LL | / if a > b {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `a <= b`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:84:5
|
|
|
|
|
LL | / if a >= b {
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `a < b`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:112:5
|
|
|
|
|
LL | / if x {
|
|
LL | | return true;
|
|
LL | | } else {
|
|
LL | | return false;
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `return x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:120:5
|
|
|
|
|
LL | / if x {
|
|
LL | | return false;
|
|
LL | | } else {
|
|
LL | | return true;
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `return !x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:128:5
|
|
|
|
|
LL | / if x && y {
|
|
LL | | return true;
|
|
LL | | } else {
|
|
LL | | return false;
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `return x && y`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:136:5
|
|
|
|
|
LL | / if x && y {
|
|
LL | | return false;
|
|
LL | | } else {
|
|
LL | | return true;
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `return !(x && y)`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/fixable.rs:144:8
|
|
|
|
|
LL | if x == true {};
|
|
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
|
|
|
|
= note: `-D clippy::bool-comparison` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]`
|
|
|
|
error: equality checks against false can be replaced by a negation
|
|
--> $DIR/fixable.rs:148:8
|
|
|
|
|
LL | if x == false {};
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/fixable.rs:158:8
|
|
|
|
|
LL | if x == true {};
|
|
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
|
|
|
error: equality checks against false can be replaced by a negation
|
|
--> $DIR/fixable.rs:159:8
|
|
|
|
|
LL | if x == false {};
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:168:12
|
|
|
|
|
LL | } else if returns_bool() {
|
|
| ____________^
|
|
LL | | false
|
|
LL | | } else {
|
|
LL | | true
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `{ !returns_bool() }`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:181:5
|
|
|
|
|
LL | / if unsafe { no(4) } & 1 != 0 {
|
|
LL | | true
|
|
LL | | } else {
|
|
LL | | false
|
|
LL | | };
|
|
| |_____^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:186:30
|
|
|
|
|
LL | let _brackets_unneeded = if unsafe { no(4) } & 1 != 0 { true } else { false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `unsafe { no(4) } & 1 != 0`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:189:9
|
|
|
|
|
LL | if unsafe { no(4) } & 1 != 0 { true } else { false }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)`
|
|
|
|
error: aborting due to 21 previous errors
|
|
|