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