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