fork/rust

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

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

master
3.6 KiB139 linesraw
1error: this `if` statement can be collapsed
2  --> $DIR/collapsible_if.rs:14:5
3   |
4LL | /     if x == "hello" {
5LL | |         if y == "world" {
6LL | |             println!("Hello world!");
7LL | |         }
8LL | |     }
9   | |_____^
10   |
11   = note: `-D clippy::collapsible-if` implied by `-D warnings`
12   = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]`
13help: collapse nested if block
14   |
15LL ~     if x == "hello" && y == "world" {
16LL +         println!("Hello world!");
17LL +     }
18   |
19
20error: this `if` statement can be collapsed
21  --> $DIR/collapsible_if.rs:20:5
22   |
23LL | /     if x == "hello" || x == "world" {
24LL | |         if y == "world" || y == "hello" {
25LL | |             println!("Hello world!");
26LL | |         }
27LL | |     }
28   | |_____^
29   |
30help: collapse nested if block
31   |
32LL ~     if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
33LL +         println!("Hello world!");
34LL +     }
35   |
36
37error: this `if` statement can be collapsed
38  --> $DIR/collapsible_if.rs:26:5
39   |
40LL | /     if x == "hello" && x == "world" {
41LL | |         if y == "world" || y == "hello" {
42LL | |             println!("Hello world!");
43LL | |         }
44LL | |     }
45   | |_____^
46   |
47help: collapse nested if block
48   |
49LL ~     if x == "hello" && x == "world" && (y == "world" || y == "hello") {
50LL +         println!("Hello world!");
51LL +     }
52   |
53
54error: this `if` statement can be collapsed
55  --> $DIR/collapsible_if.rs:32:5
56   |
57LL | /     if x == "hello" || x == "world" {
58LL | |         if y == "world" && y == "hello" {
59LL | |             println!("Hello world!");
60LL | |         }
61LL | |     }
62   | |_____^
63   |
64help: collapse nested if block
65   |
66LL ~     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
67LL +         println!("Hello world!");
68LL +     }
69   |
70
71error: this `if` statement can be collapsed
72  --> $DIR/collapsible_if.rs:38:5
73   |
74LL | /     if x == "hello" && x == "world" {
75LL | |         if y == "world" && y == "hello" {
76LL | |             println!("Hello world!");
77LL | |         }
78LL | |     }
79   | |_____^
80   |
81help: collapse nested if block
82   |
83LL ~     if x == "hello" && x == "world" && y == "world" && y == "hello" {
84LL +         println!("Hello world!");
85LL +     }
86   |
87
88error: this `if` statement can be collapsed
89  --> $DIR/collapsible_if.rs:44:5
90   |
91LL | /     if 42 == 1337 {
92LL | |         if 'a' != 'A' {
93LL | |             println!("world!")
94LL | |         }
95LL | |     }
96   | |_____^
97   |
98help: collapse nested if block
99   |
100LL ~     if 42 == 1337 && 'a' != 'A' {
101LL +         println!("world!")
102LL +     }
103   |
104
105error: this `if` statement can be collapsed
106  --> $DIR/collapsible_if.rs:100:5
107   |
108LL | /     if x == "hello" {
109LL | |         if y == "world" { // Collapsible
110LL | |             println!("Hello world!");
111LL | |         }
112LL | |     }
113   | |_____^
114   |
115help: collapse nested if block
116   |
117LL ~     if x == "hello" && y == "world" { // Collapsible
118LL +         println!("Hello world!");
119LL +     }
120   |
121
122error: this `if` statement can be collapsed
123  --> $DIR/collapsible_if.rs:159:5
124   |
125LL | /     if matches!(true, true) {
126LL | |         if matches!(true, true) {}
127LL | |     }
128   | |_____^ help: collapse nested if block: `if matches!(true, true) && matches!(true, true) {}`
129
130error: this `if` statement can be collapsed
131  --> $DIR/collapsible_if.rs:164:5
132   |
133LL | /     if matches!(true, true) && truth() {
134LL | |         if matches!(true, true) {}
135LL | |     }
136   | |_____^ help: collapse nested if block: `if matches!(true, true) && truth() && matches!(true, true) {}`
137
138error: aborting due to 9 previous errors
139