]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/copies.stderr
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / copies.stderr
index 315ff79ca49c894529bcc9b61192ccb0859c6e70..3fbc279b5374515e2e6a5b57bc189fb1ee04d35f 100644 (file)
 error: this `if` has identical blocks
-  --> $DIR/copies.rs:40:10
+  --> $DIR/copies.rs:50:12
    |
-40 |       else {
-   |  __________^ starting here...
-41 | |         Foo { bar: 42 };
-42 | |         0..10;
-43 | |         ..;
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         Foo { bar: 42 };
+LL | |         0..10;
 ...  |
-47 | |         foo();
-48 | |     }
-   | |_____^ ...ending here
+LL | |         foo();
+LL | |     }
+   | |_____^
    |
-note: lint level defined here
-  --> $DIR/copies.rs:27:8
-   |
-27 | #[deny(if_same_then_else)]
-   |        ^^^^^^^^^^^^^^^^^
+   = note: `-D clippy::if-same-then-else` implied by `-D warnings`
 note: same as this
-  --> $DIR/copies.rs:30:13
+  --> $DIR/copies.rs:42:13
    |
-30 |       if true {
-   |  _____________^ starting here...
-31 | |
-32 | |         Foo { bar: 42 };
-33 | |         0..10;
+LL |       if true {
+   |  _____________^
+LL | |         Foo { bar: 42 };
+LL | |         0..10;
+LL | |         ..;
 ...  |
-38 | |         foo();
-39 | |     }
-   | |_____^ ...ending here
+LL | |         foo();
+LL | |     } else {
+   | |_____^
 
 error: this `match` has identical arm bodies
-  --> $DIR/copies.rs:91:14
+  --> $DIR/copies.rs:96:14
    |
-91 |           _ => {
-   |  ______________^ starting here...
-92 | |             foo();
-93 | |             let mut a = 42 + [23].len() as i32;
-94 | |             if true {
+LL |           _ => {
+   |  ______________^
+LL | |             //~ ERROR match arms have same body
+LL | |             foo();
+LL | |             let mut a = 42 + [23].len() as i32;
 ...  |
-98 | |             a
-99 | |         }
-   | |_________^ ...ending here
-   |
-note: lint level defined here
-  --> $DIR/copies.rs:28:8
+LL | |             a
+LL | |         },
+   | |_________^
    |
-28 | #[deny(match_same_arms)]
-   |        ^^^^^^^^^^^^^^^
+   = note: `-D clippy::match-same-arms` implied by `-D warnings`
 note: same as this
-  --> $DIR/copies.rs:80:15
+  --> $DIR/copies.rs:87:15
    |
-80 |           42 => {
-   |  _______________^ starting here...
-81 | |
-82 | |
-83 | |             foo();
+LL |           42 => {
+   |  _______________^
+LL | |             foo();
+LL | |             let mut a = 42 + [23].len() as i32;
+LL | |             if true {
 ...  |
-89 | |             a
-90 | |         }
-   | |_________^ ...ending here
+LL | |             a
+LL | |         },
+   | |_________^
 note: `42` has the same arm body as the `_` wildcard, consider removing it`
-  --> $DIR/copies.rs:80:15
+  --> $DIR/copies.rs:87:15
    |
-80 |           42 => {
-   |  _______________^ starting here...
-81 | |
-82 | |
-83 | |             foo();
+LL |           42 => {
+   |  _______________^
+LL | |             foo();
+LL | |             let mut a = 42 + [23].len() as i32;
+LL | |             if true {
 ...  |
-89 | |             a
-90 | |         }
-   | |_________^ ...ending here
+LL | |             a
+LL | |         },
+   | |_________^
 
 error: this `match` has identical arm bodies
-   --> $DIR/copies.rs:107:14
-    |
-107 |         _ => 0,
-    |              ^
-    |
+  --> $DIR/copies.rs:111:14
+   |
+LL |         _ => 0, //~ ERROR match arms have same body
+   |              ^
+   |
 note: same as this
-   --> $DIR/copies.rs:103:19
-    |
-103 |         Abc::A => 0,
-    |                   ^
+  --> $DIR/copies.rs:109:19
+   |
+LL |         Abc::A => 0,
+   |                   ^
 note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
-   --> $DIR/copies.rs:103:19
-    |
-103 |         Abc::A => 0,
-    |                   ^
-
-error: this `if` has identical blocks
-   --> $DIR/copies.rs:118:10
-    |
-118 |       else {
-    |  __________^ starting here...
-119 | |         42
-120 | |     };
-    | |_____^ ...ending here
-    |
-note: same as this
-   --> $DIR/copies.rs:114:21
-    |
-114 |       let _ = if true {
-    |  _____________________^ starting here...
-115 | |
-116 | |         42
-117 | |     }
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:109:19
+   |
+LL |         Abc::A => 0,
+   |                   ^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:133:10
-    |
-133 |       else {
-    |  __________^ starting here...
-134 | |         for _ in &[42] {
-135 | |             let foo: &Option<_> = &Some::<u8>(42);
-136 | |             if true {
-...   |
-141 | |         }
-142 | |     }
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:120:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         42
+LL | |     };
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:122:13
-    |
-122 |       if true {
-    |  _____________^ starting here...
-123 | |
-124 | |         for _ in &[42] {
-125 | |             let foo: &Option<_> = &Some::<u8>(42);
-...   |
-131 | |         }
-132 | |     }
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:118:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         42
+LL | |     } else {
+   | |_____^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:156:10
-    |
-156 |       else {
-    |  __________^ starting here...
-157 | |         let bar = if true {
-158 | |             42
-159 | |         }
-...   |
-165 | |         bar + 1;
-166 | |     }
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:134:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         for _ in &[42] {
+LL | |             let foo: &Option<_> = &Some::<u8>(42);
+...  |
+LL | |         }
+LL | |     }
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:144:13
-    |
-144 |       if true {
-    |  _____________^ starting here...
-145 | |
-146 | |         let bar = if true {
-147 | |             42
-...   |
-154 | |         bar + 1;
-155 | |     }
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:125:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         for _ in &[42] {
+LL | |             let foo: &Option<_> = &Some::<u8>(42);
+LL | |             if true {
+...  |
+LL | |         }
+LL | |     } else {
+   | |_____^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:180:19
-    |
-180 |       else if foo() {
-    |  ___________________^ starting here...
-181 | |         let _ = match 42 {
-182 | |             42 => 1,
-183 | |             a if a > 0 => 2,
-...   |
-186 | |         };
-187 | |     }
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:153:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         let bar = if true { 42 } else { 43 };
+LL | |
+...  |
+LL | |         bar + 1;
+LL | |     }
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:168:13
-    |
-168 |       if true {
-    |  _____________^ starting here...
-169 | |
-170 | |         let _ = match 42 {
-171 | |             42 => 1,
-...   |
-175 | |         };
-176 | |     }
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:146:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         let bar = if true { 42 } else { 43 };
+LL | |
+LL | |         while foo() {
+...  |
+LL | |         bar + 1;
+LL | |     } else {
+   | |_____^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:193:10
-    |
-193 |       else {
-    |  __________^ starting here...
-194 | |         if let Some(a) = Some(42) {}
-195 | |     }
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:183:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         if let Some(a) = Some(42) {}
+LL | |     }
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:189:13
-    |
-189 |       if true {
-    |  _____________^ starting here...
-190 | |
-191 | |         if let Some(a) = Some(42) {}
-192 | |     }
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:181:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         if let Some(a) = Some(42) {}
+LL | |     } else {
+   | |_____^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:201:10
-    |
-201 |       else {
-    |  __________^ starting here...
-202 | |         if let (1, .., 3) = (1, 2, 3) {}
-203 | |     }
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:190:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         if let (1, .., 3) = (1, 2, 3) {}
+LL | |     }
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:197:13
-    |
-197 |       if true {
-    |  _____________^ starting here...
-198 | |
-199 | |         if let (1, .., 3) = (1, 2, 3) {}
-200 | |     }
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:188:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         if let (1, .., 3) = (1, 2, 3) {}
+LL | |     } else {
+   | |_____^
 
 error: this `match` has identical arm bodies
-   --> $DIR/copies.rs:258:15
-    |
-258 |         51 => foo(),
-    |               ^^^^^
-    |
+  --> $DIR/copies.rs:239:15
+   |
+LL |         51 => foo(), //~ ERROR match arms have same body
+   |               ^^^^^
+   |
 note: same as this
-   --> $DIR/copies.rs:255:15
-    |
-255 |         42 => foo(),
-    |               ^^^^^
+  --> $DIR/copies.rs:238:15
+   |
+LL |         42 => foo(),
+   |               ^^^^^
 note: consider refactoring into `42 | 51`
-   --> $DIR/copies.rs:255:15
-    |
-255 |         42 => foo(),
-    |               ^^^^^
+  --> $DIR/copies.rs:238:15
+   |
+LL |         42 => foo(),
+   |               ^^^^^
 
 error: this `match` has identical arm bodies
-   --> $DIR/copies.rs:266:17
-    |
-266 |         None => 24,
-    |                 ^^
-    |
+  --> $DIR/copies.rs:245:17
+   |
+LL |         None => 24, //~ ERROR match arms have same body
+   |                 ^^
+   |
 note: same as this
-   --> $DIR/copies.rs:263:20
-    |
-263 |         Some(_) => 24,
-    |                    ^^
+  --> $DIR/copies.rs:244:20
+   |
+LL |         Some(_) => 24,
+   |                    ^^
 note: consider refactoring into `Some(_) | None`
-   --> $DIR/copies.rs:263:20
-    |
-263 |         Some(_) => 24,
-    |                    ^^
+  --> $DIR/copies.rs:244:20
+   |
+LL |         Some(_) => 24,
+   |                    ^^
 
 error: this `match` has identical arm bodies
-   --> $DIR/copies.rs:290:28
-    |
-290 |         (None, Some(a)) => bar(a),
-    |                            ^^^^^^
-    |
+  --> $DIR/copies.rs:267:28
+   |
+LL |         (None, Some(a)) => bar(a), //~ ERROR match arms have same body
+   |                            ^^^^^^
+   |
 note: same as this
-   --> $DIR/copies.rs:287:28
-    |
-287 |         (Some(a), None) => bar(a),
-    |                            ^^^^^^
+  --> $DIR/copies.rs:266:28
+   |
+LL |         (Some(a), None) => bar(a),
+   |                            ^^^^^^
 note: consider refactoring into `(Some(a), None) | (None, Some(a))`
-   --> $DIR/copies.rs:287:28
-    |
-287 |         (Some(a), None) => bar(a),
-    |                            ^^^^^^
+  --> $DIR/copies.rs:266:28
+   |
+LL |         (Some(a), None) => bar(a),
+   |                            ^^^^^^
 
 error: this `match` has identical arm bodies
-   --> $DIR/copies.rs:298:26
-    |
-298 |         (.., Some(a)) => bar(a),
-    |                          ^^^^^^
-    |
+  --> $DIR/copies.rs:273:26
+   |
+LL |         (.., Some(a)) => bar(a), //~ ERROR match arms have same body
+   |                          ^^^^^^
+   |
 note: same as this
-   --> $DIR/copies.rs:295:26
-    |
-295 |         (Some(a), ..) => bar(a),
-    |                          ^^^^^^
+  --> $DIR/copies.rs:272:26
+   |
+LL |         (Some(a), ..) => bar(a),
+   |                          ^^^^^^
 note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
-   --> $DIR/copies.rs:295:26
-    |
-295 |         (Some(a), ..) => bar(a),
-    |                          ^^^^^^
+  --> $DIR/copies.rs:272:26
+   |
+LL |         (Some(a), ..) => bar(a),
+   |                          ^^^^^^
 
 error: this `match` has identical arm bodies
-   --> $DIR/copies.rs:306:20
-    |
-306 |         (.., 3) => 42,
-    |                    ^^
-    |
+  --> $DIR/copies.rs:279:20
+   |
+LL |         (.., 3) => 42, //~ ERROR match arms have same body
+   |                    ^^
+   |
 note: same as this
-   --> $DIR/copies.rs:303:23
-    |
-303 |         (1, .., 3) => 42,
-    |                       ^^
+  --> $DIR/copies.rs:278:23
+   |
+LL |         (1, .., 3) => 42,
+   |                       ^^
 note: consider refactoring into `(1, .., 3) | (.., 3)`
-   --> $DIR/copies.rs:303:23
-    |
-303 |         (1, .., 3) => 42,
-    |                       ^^
-
-error: this `if` has identical blocks
-   --> $DIR/copies.rs:313:12
-    |
-313 |       } else {
-    |  ____________^ starting here...
-314 | |         0.0
-315 | |     };
-    | |_____^ ...ending here
-    |
-note: same as this
-   --> $DIR/copies.rs:310:21
-    |
-310 |       let _ = if true {
-    |  _____________________^ starting here...
-311 | |
-312 | |         0.0
-313 | |     } else {
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:278:23
+   |
+LL |         (1, .., 3) => 42,
+   |                       ^^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:320:12
-    |
-320 |       } else {
-    |  ____________^ starting here...
-321 | |         -0.0
-322 | |     };
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:285:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         0.0
+LL | |     };
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:317:21
-    |
-317 |       let _ = if true {
-    |  _____________________^ starting here...
-318 | |
-319 | |         -0.0
-320 | |     } else {
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:283:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         0.0
+LL | |     } else {
+   | |_____^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:341:12
-    |
-341 |       } else {
-    |  ____________^ starting here...
-342 | |         std::f32::NAN
-343 | |     };
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:292:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         -0.0
+LL | |     };
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:338:21
-    |
-338 |       let _ = if true {
-    |  _____________________^ starting here...
-339 | |
-340 | |         std::f32::NAN
-341 | |     } else {
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:290:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         -0.0
+LL | |     } else {
+   | |_____^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:360:10
-    |
-360 |       else {
-    |  __________^ starting here...
-361 | |         try!(Ok("foo"));
-362 | |     }
-    | |_____^ ...ending here
-    |
+  --> $DIR/copies.rs:305:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         std::f32::NAN
+LL | |     };
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:356:13
-    |
-356 |       if true {
-    |  _____________^ starting here...
-357 | |
-358 | |         try!(Ok("foo"));
-359 | |     }
-    | |_____^ ...ending here
+  --> $DIR/copies.rs:303:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         std::f32::NAN
+LL | |     } else {
+   | |_____^
 
 error: this `if` has identical blocks
-   --> $DIR/copies.rs:373:10
-    |
-373 |       else {
-    |  __________^ starting here...
-374 | |         let foo = "";
-375 | |         return Ok(&foo[0..]);
-376 | |     }
-    | |_____^ ...ending here
-    |
-note: same as this
-   --> $DIR/copies.rs:364:13
-    |
-364 |       if true {
-    |  _____________^ starting here...
-365 | |
-366 | |         let foo = "";
-367 | |         return Ok(&foo[0..]);
-368 | |     }
-    | |_____^ ...ending here
-
-error: this `if` has the same condition as a previous if
-   --> $DIR/copies.rs:388:13
-    |
-388 |     else if b {
-    |             ^
-    |
-note: lint level defined here
-   --> $DIR/copies.rs:379:8
-    |
-379 | #[deny(ifs_same_cond)]
-    |        ^^^^^^^^^^^^^
-note: same as this
-   --> $DIR/copies.rs:385:8
-    |
-385 |     if b {
-    |        ^
-
-error: this `if` has the same condition as a previous if
-   --> $DIR/copies.rs:394:13
-    |
-394 |     else if a == 1 {
-    |             ^^^^^^
-    |
-note: same as this
-   --> $DIR/copies.rs:391:8
-    |
-391 |     if a == 1 {
-    |        ^^^^^^
-
-error: this `if` has the same condition as a previous if
-   --> $DIR/copies.rs:402:13
-    |
-402 |     else if 2*a == 1 {
-    |             ^^^^^^^^
-    |
+  --> $DIR/copies.rs:323:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         try!(Ok("foo"));
+LL | |     }
+   | |_____^
+   |
 note: same as this
-   --> $DIR/copies.rs:397:8
-    |
-397 |     if 2*a == 1 {
-    |        ^^^^^^^^
+  --> $DIR/copies.rs:321:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         try!(Ok("foo"));
+LL | |     } else {
+   | |_____^
 
-error: aborting due to 22 previous errors
+error: aborting due to 17 previous errors