]> git.lizzy.rs Git - rust.git/blob - tests/ui/collapsible_if.stderr
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / collapsible_if.stderr
1 error: this if statement can be collapsed
2   --> $DIR/collapsible_if.rs:15:5
3    |
4 LL | /     if x == "hello" {
5 LL | |         if y == "world" {
6 LL | |             println!("Hello world!");
7 LL | |         }
8 LL | |     }
9    | |_____^
10    |
11    = note: `-D clippy::collapsible-if` implied by `-D warnings`
12 help: try
13    |
14 LL |     if x == "hello" && y == "world" {
15 LL |     println!("Hello world!");
16 LL | }
17    |
18
19 error: this if statement can be collapsed
20   --> $DIR/collapsible_if.rs:21:5
21    |
22 LL | /     if x == "hello" || x == "world" {
23 LL | |         if y == "world" || y == "hello" {
24 LL | |             println!("Hello world!");
25 LL | |         }
26 LL | |     }
27    | |_____^
28 help: try
29    |
30 LL |     if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
31 LL |     println!("Hello world!");
32 LL | }
33    |
34
35 error: this if statement can be collapsed
36   --> $DIR/collapsible_if.rs:27:5
37    |
38 LL | /     if x == "hello" && x == "world" {
39 LL | |         if y == "world" || y == "hello" {
40 LL | |             println!("Hello world!");
41 LL | |         }
42 LL | |     }
43    | |_____^
44 help: try
45    |
46 LL |     if x == "hello" && x == "world" && (y == "world" || y == "hello") {
47 LL |     println!("Hello world!");
48 LL | }
49    |
50
51 error: this if statement can be collapsed
52   --> $DIR/collapsible_if.rs:33:5
53    |
54 LL | /     if x == "hello" || x == "world" {
55 LL | |         if y == "world" && y == "hello" {
56 LL | |             println!("Hello world!");
57 LL | |         }
58 LL | |     }
59    | |_____^
60 help: try
61    |
62 LL |     if (x == "hello" || x == "world") && y == "world" && y == "hello" {
63 LL |     println!("Hello world!");
64 LL | }
65    |
66
67 error: this if statement can be collapsed
68   --> $DIR/collapsible_if.rs:39:5
69    |
70 LL | /     if x == "hello" && x == "world" {
71 LL | |         if y == "world" && y == "hello" {
72 LL | |             println!("Hello world!");
73 LL | |         }
74 LL | |     }
75    | |_____^
76 help: try
77    |
78 LL |     if x == "hello" && x == "world" && y == "world" && y == "hello" {
79 LL |     println!("Hello world!");
80 LL | }
81    |
82
83 error: this if statement can be collapsed
84   --> $DIR/collapsible_if.rs:45:5
85    |
86 LL | /     if 42 == 1337 {
87 LL | |         if 'a' != 'A' {
88 LL | |             println!("world!")
89 LL | |         }
90 LL | |     }
91    | |_____^
92 help: try
93    |
94 LL |     if 42 == 1337 && 'a' != 'A' {
95 LL |     println!("world!")
96 LL | }
97    |
98
99 error: this `else { if .. }` block can be collapsed
100   --> $DIR/collapsible_if.rs:54:12
101    |
102 LL |       } else {
103    |  ____________^
104 LL | |         if y == "world" {
105 LL | |             println!("world!")
106 LL | |         }
107 LL | |     }
108    | |_____^
109 help: try
110    |
111 LL |     } else if y == "world" {
112 LL |     println!("world!")
113 LL | }
114    |
115
116 error: this `else { if .. }` block can be collapsed
117   --> $DIR/collapsible_if.rs:62:12
118    |
119 LL |       } else {
120    |  ____________^
121 LL | |         if let Some(42) = Some(42) {
122 LL | |             println!("world!")
123 LL | |         }
124 LL | |     }
125    | |_____^
126 help: try
127    |
128 LL |     } else if let Some(42) = Some(42) {
129 LL |     println!("world!")
130 LL | }
131    |
132
133 error: this `else { if .. }` block can be collapsed
134   --> $DIR/collapsible_if.rs:70:12
135    |
136 LL |       } else {
137    |  ____________^
138 LL | |         if y == "world" {
139 LL | |             println!("world")
140 LL | |         }
141 ...  |
142 LL | |         }
143 LL | |     }
144    | |_____^
145 help: try
146    |
147 LL |     } else if y == "world" {
148 LL |     println!("world")
149 LL | }
150 LL | else {
151 LL |     println!("!")
152 LL | }
153    |
154
155 error: this `else { if .. }` block can be collapsed
156   --> $DIR/collapsible_if.rs:81:12
157    |
158 LL |       } else {
159    |  ____________^
160 LL | |         if let Some(42) = Some(42) {
161 LL | |             println!("world")
162 LL | |         }
163 ...  |
164 LL | |         }
165 LL | |     }
166    | |_____^
167 help: try
168    |
169 LL |     } else if let Some(42) = Some(42) {
170 LL |     println!("world")
171 LL | }
172 LL | else {
173 LL |     println!("!")
174 LL | }
175    |
176
177 error: this `else { if .. }` block can be collapsed
178   --> $DIR/collapsible_if.rs:92:12
179    |
180 LL |       } else {
181    |  ____________^
182 LL | |         if let Some(42) = Some(42) {
183 LL | |             println!("world")
184 LL | |         }
185 ...  |
186 LL | |         }
187 LL | |     }
188    | |_____^
189 help: try
190    |
191 LL |     } else if let Some(42) = Some(42) {
192 LL |     println!("world")
193 LL | }
194 LL | else {
195 LL |     println!("!")
196 LL | }
197    |
198
199 error: this `else { if .. }` block can be collapsed
200   --> $DIR/collapsible_if.rs:103:12
201    |
202 LL |       } else {
203    |  ____________^
204 LL | |         if x == "hello" {
205 LL | |             println!("world")
206 LL | |         }
207 ...  |
208 LL | |         }
209 LL | |     }
210    | |_____^
211 help: try
212    |
213 LL |     } else if x == "hello" {
214 LL |     println!("world")
215 LL | }
216 LL | else {
217 LL |     println!("!")
218 LL | }
219    |
220
221 error: this `else { if .. }` block can be collapsed
222   --> $DIR/collapsible_if.rs:114:12
223    |
224 LL |       } else {
225    |  ____________^
226 LL | |         if let Some(42) = Some(42) {
227 LL | |             println!("world")
228 LL | |         }
229 ...  |
230 LL | |         }
231 LL | |     }
232    | |_____^
233 help: try
234    |
235 LL |     } else if let Some(42) = Some(42) {
236 LL |     println!("world")
237 LL | }
238 LL | else {
239 LL |     println!("!")
240 LL | }
241    |
242
243 error: this if statement can be collapsed
244   --> $DIR/collapsible_if.rs:173:5
245    |
246 LL | /     if x == "hello" {
247 LL | |         if y == "world" { // Collapsible
248 LL | |             println!("Hello world!");
249 LL | |         }
250 LL | |     }
251    | |_____^
252 help: try
253    |
254 LL |     if x == "hello" && y == "world" { // Collapsible
255 LL |     println!("Hello world!");
256 LL | }
257    |
258
259 error: aborting due to 14 previous errors
260