]> git.lizzy.rs Git - rust.git/blob - tests/ui/copies.stderr
Merge pull request #1748 from luisbg/empty_lines
[rust.git] / tests / ui / copies.stderr
1 warning: This else block is redundant.
2
3    --> $DIR/copies.rs:121:20
4     |
5 121 |               } else {
6     |  ____________________^
7 122 | |                 continue;
8 123 | |             }
9     | |_____________^
10     |
11     = note: #[warn(needless_continue)] on by default
12     = help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
13             if true {
14             break;
15             // Merged code follows...
16             }
17             
18
19 warning: This else block is redundant.
20
21    --> $DIR/copies.rs:131:20
22     |
23 131 |               } else {
24     |  ____________________^
25 132 | |                 continue;
26 133 | |             }
27     | |_____________^
28     |
29     = note: #[warn(needless_continue)] on by default
30     = help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
31             if true {
32             break;
33             // Merged code follows...
34             }
35             
36
37 error: this `if` has identical blocks
38   --> $DIR/copies.rs:39:10
39    |
40 39 |       else {
41    |  __________^
42 40 | |         Foo { bar: 42 };
43 41 | |         0..10;
44 42 | |         ..;
45 ...  |
46 46 | |         foo();
47 47 | |     }
48    | |_____^
49    |
50 note: lint level defined here
51   --> $DIR/copies.rs:27:8
52    |
53 27 | #[deny(if_same_then_else)]
54    |        ^^^^^^^^^^^^^^^^^
55 note: same as this
56   --> $DIR/copies.rs:30:13
57    |
58 30 |       if true {
59    |  _____________^
60 31 | |         Foo { bar: 42 };
61 32 | |         0..10;
62 33 | |         ..;
63 ...  |
64 37 | |         foo();
65 38 | |     }
66    | |_____^
67
68 error: this `match` has identical arm bodies
69   --> $DIR/copies.rs:88:14
70    |
71 88 |           _ => {
72    |  ______________^
73 89 | |             foo();
74 90 | |             let mut a = 42 + [23].len() as i32;
75 91 | |             if true {
76 ...  |
77 95 | |             a
78 96 | |         }
79    | |_________^
80    |
81 note: lint level defined here
82   --> $DIR/copies.rs:28:8
83    |
84 28 | #[deny(match_same_arms)]
85    |        ^^^^^^^^^^^^^^^
86 note: same as this
87   --> $DIR/copies.rs:79:15
88    |
89 79 |           42 => {
90    |  _______________^
91 80 | |             foo();
92 81 | |             let mut a = 42 + [23].len() as i32;
93 82 | |             if true {
94 ...  |
95 86 | |             a
96 87 | |         }
97    | |_________^
98 note: `42` has the same arm body as the `_` wildcard, consider removing it`
99   --> $DIR/copies.rs:79:15
100    |
101 79 |           42 => {
102    |  _______________^
103 80 | |             foo();
104 81 | |             let mut a = 42 + [23].len() as i32;
105 82 | |             if true {
106 ...  |
107 86 | |             a
108 87 | |         }
109    | |_________^
110
111 error: this `match` has identical arm bodies
112    --> $DIR/copies.rs:102:14
113     |
114 102 |         _ => 0,
115     |              ^
116     |
117 note: same as this
118    --> $DIR/copies.rs:100:19
119     |
120 100 |         Abc::A => 0,
121     |                   ^
122 note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
123    --> $DIR/copies.rs:100:19
124     |
125 100 |         Abc::A => 0,
126     |                   ^
127
128 error: this `if` has identical blocks
129    --> $DIR/copies.rs:112:10
130     |
131 112 |       else {
132     |  __________^
133 113 | |         42
134 114 | |     };
135     | |_____^
136     |
137 note: same as this
138    --> $DIR/copies.rs:109:21
139     |
140 109 |       let _ = if true {
141     |  _____________________^
142 110 | |         42
143 111 | |     }
144     | |_____^
145
146 error: this `if` has identical blocks
147    --> $DIR/copies.rs:126:10
148     |
149 126 |       else {
150     |  __________^
151 127 | |         for _ in &[42] {
152 128 | |             let foo: &Option<_> = &Some::<u8>(42);
153 129 | |             if true {
154 ...   |
155 134 | |         }
156 135 | |     }
157     | |_____^
158     |
159 note: same as this
160    --> $DIR/copies.rs:116:13
161     |
162 116 |       if true {
163     |  _____________^
164 117 | |         for _ in &[42] {
165 118 | |             let foo: &Option<_> = &Some::<u8>(42);
166 119 | |             if true {
167 ...   |
168 124 | |         }
169 125 | |     }
170     | |_____^
171
172 error: this `if` has identical blocks
173    --> $DIR/copies.rs:148:10
174     |
175 148 |       else {
176     |  __________^
177 149 | |         let bar = if true {
178 150 | |             42
179 151 | |         }
180 ...   |
181 157 | |         bar + 1;
182 158 | |     }
183     | |_____^
184     |
185 note: same as this
186    --> $DIR/copies.rs:137:13
187     |
188 137 |       if true {
189     |  _____________^
190 138 | |         let bar = if true {
191 139 | |             42
192 140 | |         }
193 ...   |
194 146 | |         bar + 1;
195 147 | |     }
196     | |_____^
197
198 error: this `if` has identical blocks
199    --> $DIR/copies.rs:171:19
200     |
201 171 |       else if foo() {
202     |  ___________________^
203 172 | |         let _ = match 42 {
204 173 | |             42 => 1,
205 174 | |             a if a > 0 => 2,
206 ...   |
207 177 | |         };
208 178 | |     }
209     | |_____^
210     |
211 note: same as this
212    --> $DIR/copies.rs:160:13
213     |
214 160 |       if true {
215     |  _____________^
216 161 | |         let _ = match 42 {
217 162 | |             42 => 1,
218 163 | |             a if a > 0 => 2,
219 ...   |
220 166 | |         };
221 167 | |     }
222     | |_____^
223
224 error: this `if` has identical blocks
225    --> $DIR/copies.rs:183:10
226     |
227 183 |       else {
228     |  __________^
229 184 | |         if let Some(a) = Some(42) {}
230 185 | |     }
231     | |_____^
232     |
233 note: same as this
234    --> $DIR/copies.rs:180:13
235     |
236 180 |       if true {
237     |  _____________^
238 181 | |         if let Some(a) = Some(42) {}
239 182 | |     }
240     | |_____^
241
242 error: this `if` has identical blocks
243    --> $DIR/copies.rs:190:10
244     |
245 190 |       else {
246     |  __________^
247 191 | |         if let (1, .., 3) = (1, 2, 3) {}
248 192 | |     }
249     | |_____^
250     |
251 note: same as this
252    --> $DIR/copies.rs:187:13
253     |
254 187 |       if true {
255     |  _____________^
256 188 | |         if let (1, .., 3) = (1, 2, 3) {}
257 189 | |     }
258     | |_____^
259
260 error: this `match` has identical arm bodies
261    --> $DIR/copies.rs:245:15
262     |
263 245 |         51 => foo(),
264     |               ^^^^^
265     |
266 note: same as this
267    --> $DIR/copies.rs:244:15
268     |
269 244 |         42 => foo(),
270     |               ^^^^^
271 note: consider refactoring into `42 | 51`
272    --> $DIR/copies.rs:244:15
273     |
274 244 |         42 => foo(),
275     |               ^^^^^
276
277 error: this `match` has identical arm bodies
278    --> $DIR/copies.rs:251:17
279     |
280 251 |         None => 24,
281     |                 ^^
282     |
283 note: same as this
284    --> $DIR/copies.rs:250:20
285     |
286 250 |         Some(_) => 24,
287     |                    ^^
288 note: consider refactoring into `Some(_) | None`
289    --> $DIR/copies.rs:250:20
290     |
291 250 |         Some(_) => 24,
292     |                    ^^
293
294 error: this `match` has identical arm bodies
295    --> $DIR/copies.rs:273:28
296     |
297 273 |         (None, Some(a)) => bar(a),
298     |                            ^^^^^^
299     |
300 note: same as this
301    --> $DIR/copies.rs:272:28
302     |
303 272 |         (Some(a), None) => bar(a),
304     |                            ^^^^^^
305 note: consider refactoring into `(Some(a), None) | (None, Some(a))`
306    --> $DIR/copies.rs:272:28
307     |
308 272 |         (Some(a), None) => bar(a),
309     |                            ^^^^^^
310
311 error: this `match` has identical arm bodies
312    --> $DIR/copies.rs:279:26
313     |
314 279 |         (.., Some(a)) => bar(a),
315     |                          ^^^^^^
316     |
317 note: same as this
318    --> $DIR/copies.rs:278:26
319     |
320 278 |         (Some(a), ..) => bar(a),
321     |                          ^^^^^^
322 note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
323    --> $DIR/copies.rs:278:26
324     |
325 278 |         (Some(a), ..) => bar(a),
326     |                          ^^^^^^
327
328 error: this `match` has identical arm bodies
329    --> $DIR/copies.rs:285:20
330     |
331 285 |         (.., 3) => 42,
332     |                    ^^
333     |
334 note: same as this
335    --> $DIR/copies.rs:284:23
336     |
337 284 |         (1, .., 3) => 42,
338     |                       ^^
339 note: consider refactoring into `(1, .., 3) | (.., 3)`
340    --> $DIR/copies.rs:284:23
341     |
342 284 |         (1, .., 3) => 42,
343     |                       ^^
344
345 error: this `if` has identical blocks
346    --> $DIR/copies.rs:291:12
347     |
348 291 |       } else {
349     |  ____________^
350 292 | |         0.0
351 293 | |     };
352     | |_____^
353     |
354 note: same as this
355    --> $DIR/copies.rs:289:21
356     |
357 289 |       let _ = if true {
358     |  _____________________^
359 290 | |         0.0
360 291 | |     } else {
361     | |_____^
362
363 error: this `if` has identical blocks
364    --> $DIR/copies.rs:297:12
365     |
366 297 |       } else {
367     |  ____________^
368 298 | |         -0.0
369 299 | |     };
370     | |_____^
371     |
372 note: same as this
373    --> $DIR/copies.rs:295:21
374     |
375 295 |       let _ = if true {
376     |  _____________________^
377 296 | |         -0.0
378 297 | |     } else {
379     | |_____^
380
381 error: this `if` has identical blocks
382    --> $DIR/copies.rs:317:12
383     |
384 317 |       } else {
385     |  ____________^
386 318 | |         std::f32::NAN
387 319 | |     };
388     | |_____^
389     |
390 note: same as this
391    --> $DIR/copies.rs:315:21
392     |
393 315 |       let _ = if true {
394     |  _____________________^
395 316 | |         std::f32::NAN
396 317 | |     } else {
397     | |_____^
398
399 error: this `if` has identical blocks
400    --> $DIR/copies.rs:335:10
401     |
402 335 |       else {
403     |  __________^
404 336 | |         try!(Ok("foo"));
405 337 | |     }
406     | |_____^
407     |
408 note: same as this
409    --> $DIR/copies.rs:332:13
410     |
411 332 |       if true {
412     |  _____________^
413 333 | |         try!(Ok("foo"));
414 334 | |     }
415     | |_____^
416
417 error: this `if` has identical blocks
418    --> $DIR/copies.rs:347:10
419     |
420 347 |       else {
421     |  __________^
422 348 | |         let foo = "";
423 349 | |         return Ok(&foo[0..]);
424 350 | |     }
425     | |_____^
426     |
427 note: same as this
428    --> $DIR/copies.rs:339:13
429     |
430 339 |       if true {
431     |  _____________^
432 340 | |         let foo = "";
433 341 | |         return Ok(&foo[0..]);
434 342 | |     }
435     | |_____^
436
437 error: this `if` has the same condition as a previous if
438    --> $DIR/copies.rs:361:13
439     |
440 361 |     else if b {
441     |             ^
442     |
443 note: lint level defined here
444    --> $DIR/copies.rs:353:8
445     |
446 353 | #[deny(ifs_same_cond)]
447     |        ^^^^^^^^^^^^^
448 note: same as this
449    --> $DIR/copies.rs:359:8
450     |
451 359 |     if b {
452     |        ^
453
454 error: this `if` has the same condition as a previous if
455    --> $DIR/copies.rs:366:13
456     |
457 366 |     else if a == 1 {
458     |             ^^^^^^
459     |
460 note: same as this
461    --> $DIR/copies.rs:364:8
462     |
463 364 |     if a == 1 {
464     |        ^^^^^^
465
466 error: this `if` has the same condition as a previous if
467    --> $DIR/copies.rs:373:13
468     |
469 373 |     else if 2*a == 1 {
470     |             ^^^^^^^^
471     |
472 note: same as this
473    --> $DIR/copies.rs:369:8
474     |
475 369 |     if 2*a == 1 {
476     |        ^^^^^^^^
477
478 error: aborting due to 22 previous errors
479