rust-clippy/tests/ui/needless_bool_assign.stderr

54 lines
1.4 KiB
Text
Raw Normal View History

error: this if-then-else expression assigns a bool literal
2023-07-27 11:40:22 +00:00
--> $DIR/needless_bool_assign.rs:13:5
|
LL | / if random() && random() {
LL | | a.field = true;
LL | | } else {
LL | | a.field = false
LL | | }
| |_____^ help: you can reduce it to: `a.field = random() && random();`
|
= note: `-D clippy::needless-bool-assign` implied by `-D warnings`
error: this if-then-else expression assigns a bool literal
2023-07-27 11:40:22 +00:00
--> $DIR/needless_bool_assign.rs:18:5
|
LL | / if random() && random() {
LL | | a.field = false;
LL | | } else {
LL | | a.field = true
LL | | }
| |_____^ help: you can reduce it to: `a.field = !(random() && random());`
error: this if-then-else expression assigns a bool literal
2023-07-27 11:40:22 +00:00
--> $DIR/needless_bool_assign.rs:32:5
|
LL | / if random() {
LL | | a.field = true;
LL | | } else {
LL | | a.field = true;
LL | | }
| |_____^ help: you can reduce it to: `random(); a.field = true;`
error: this `if` has identical blocks
2023-07-27 11:40:22 +00:00
--> $DIR/needless_bool_assign.rs:32:17
|
LL | if random() {
| _________________^
LL | | a.field = true;
LL | | } else {
| |_____^
|
note: same as this
2023-07-27 11:40:22 +00:00
--> $DIR/needless_bool_assign.rs:34:12
|
LL | } else {
| ____________^
LL | | a.field = true;
LL | | }
| |_____^
= note: `#[deny(clippy::if_same_then_else)]` on by default
error: aborting due to 4 previous errors