fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.5 KiB54 linesraw
1error: this if-then-else expression assigns a bool literal
2  --> $DIR/needless_bool_assign.rs:13:5
3   |
4LL | /     if random() && random() {
5LL | |         a.field = true;
6LL | |     } else {
7LL | |         a.field = false
8LL | |     }
9   | |_____^ help: you can reduce it to: `a.field = random() && random();`
10   |
11   = note: `-D clippy::needless-bool-assign` implied by `-D warnings`
12   = help: to override `-D warnings` add `#[allow(clippy::needless_bool_assign)]`
13
14error: this if-then-else expression assigns a bool literal
15  --> $DIR/needless_bool_assign.rs:18:5
16   |
17LL | /     if random() && random() {
18LL | |         a.field = false;
19LL | |     } else {
20LL | |         a.field = true
21LL | |     }
22   | |_____^ help: you can reduce it to: `a.field = !(random() && random());`
23
24error: this if-then-else expression assigns a bool literal
25  --> $DIR/needless_bool_assign.rs:32:5
26   |
27LL | /     if random() {
28LL | |         a.field = true;
29LL | |     } else {
30LL | |         a.field = true;
31LL | |     }
32   | |_____^ help: you can reduce it to: `random(); a.field = true;`
33
34error: this `if` has identical blocks
35  --> $DIR/needless_bool_assign.rs:32:17
36   |
37LL |       if random() {
38   |  _________________^
39LL | |         a.field = true;
40LL | |     } else {
41   | |_____^
42   |
43note: same as this
44  --> $DIR/needless_bool_assign.rs:34:12
45   |
46LL |       } else {
47   |  ____________^
48LL | |         a.field = true;
49LL | |     }
50   | |_____^
51   = note: `#[deny(clippy::if_same_then_else)]` on by default
52
53error: aborting due to 4 previous errors
54