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