2023-05-05 15:45:49 +00:00
|
|
|
error: this if-then-else expression assigns a bool literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/needless_bool_assign.rs:13:5
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
|
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`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::needless_bool_assign)]`
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
error: this if-then-else expression assigns a bool literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/needless_bool_assign.rs:18:5
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
|
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
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/needless_bool_assign.rs:32:5
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
|
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
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/needless_bool_assign.rs:32:17
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
|
LL | if random() {
|
|
|
|
| _________________^
|
|
|
|
LL | | a.field = true;
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
note: same as this
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/needless_bool_assign.rs:34:12
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | a.field = true;
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2023-11-16 18:13:24 +00:00
|
|
|
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::if_same_then_else)]`
|
2023-05-05 15:45:49 +00:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|