blob: 244a88e6691fd5d6479f9b80edb3661f4811c92d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
error: this if-then-else expression assigns a bool literal
--> $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`
= help: to override `-D warnings` add `#[allow(clippy::needless_bool_assign)]`
error: this if-then-else expression assigns a bool literal
--> $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
--> $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
--> $DIR/needless_bool_assign.rs:32:17
|
LL | if random() {
| _________________^
LL | | a.field = true;
LL | | } else {
| |_____^
|
note: same as this
--> $DIR/needless_bool_assign.rs:34:12
|
LL | } else {
| ____________^
LL | | a.field = true;
LL | | }
| |_____^
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::if_same_then_else)]`
error: aborting due to 4 previous errors
|