]> 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 9accb310d121337aea7e37ffc024ba640793d126..3fbc279b5374515e2e6a5b57bc189fb1ee04d35f 100644 (file)
-error: This else block is redundant.
-
-   --> $DIR/copies.rs:120:20
-    |
-120 |               } else {
-    |  ____________________^
-121 | |                 continue;
-122 | |             }
-    | |_____________^
-    |
-    = note: `-D needless-continue` implied by `-D warnings`
-    = help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
-            if true {
-            break;
-            // Merged code follows...
-            }
-            
-
-error: This else block is redundant.
-
-   --> $DIR/copies.rs:130:20
-    |
-130 |               } else {
-    |  ____________________^
-131 | |                 continue;
-132 | |             }
-    | |_____________^
-    |
-    = help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so:
-            if true {
-            break;
-            // Merged code follows...
-            }
-            
-
-error: aborting due to 2 previous errors
+error: this `if` has identical blocks
+  --> $DIR/copies.rs:50:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         Foo { bar: 42 };
+LL | |         0..10;
+...  |
+LL | |         foo();
+LL | |     }
+   | |_____^
+   |
+   = note: `-D clippy::if-same-then-else` implied by `-D warnings`
+note: same as this
+  --> $DIR/copies.rs:42:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         Foo { bar: 42 };
+LL | |         0..10;
+LL | |         ..;
+...  |
+LL | |         foo();
+LL | |     } else {
+   | |_____^
+
+error: this `match` has identical arm bodies
+  --> $DIR/copies.rs:96:14
+   |
+LL |           _ => {
+   |  ______________^
+LL | |             //~ ERROR match arms have same body
+LL | |             foo();
+LL | |             let mut a = 42 + [23].len() as i32;
+...  |
+LL | |             a
+LL | |         },
+   | |_________^
+   |
+   = note: `-D clippy::match-same-arms` implied by `-D warnings`
+note: same as this
+  --> $DIR/copies.rs:87:15
+   |
+LL |           42 => {
+   |  _______________^
+LL | |             foo();
+LL | |             let mut a = 42 + [23].len() as i32;
+LL | |             if true {
+...  |
+LL | |             a
+LL | |         },
+   | |_________^
+note: `42` has the same arm body as the `_` wildcard, consider removing it`
+  --> $DIR/copies.rs:87:15
+   |
+LL |           42 => {
+   |  _______________^
+LL | |             foo();
+LL | |             let mut a = 42 + [23].len() as i32;
+LL | |             if true {
+...  |
+LL | |             a
+LL | |         },
+   | |_________^
+
+error: this `match` has identical arm bodies
+  --> $DIR/copies.rs:111:14
+   |
+LL |         _ => 0, //~ ERROR match arms have same body
+   |              ^
+   |
+note: same as this
+  --> $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:109:19
+   |
+LL |         Abc::A => 0,
+   |                   ^
+
+error: this `if` has identical blocks
+  --> $DIR/copies.rs:120:12
+   |
+LL |       } else {
+   |  ____________^
+LL | |         //~ ERROR same body as `if` block
+LL | |         42
+LL | |     };
+   | |_____^
+   |
+note: same as this
+  --> $DIR/copies.rs:118:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         42
+LL | |     } else {
+   | |_____^
+
+error: this `if` has identical blocks
+  --> $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: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: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: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: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:181:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         if let Some(a) = Some(42) {}
+LL | |     } else {
+   | |_____^
+
+error: this `if` has identical blocks
+  --> $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: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:239:15
+   |
+LL |         51 => foo(), //~ ERROR match arms have same body
+   |               ^^^^^
+   |
+note: same as this
+  --> $DIR/copies.rs:238:15
+   |
+LL |         42 => foo(),
+   |               ^^^^^
+note: consider refactoring into `42 | 51`
+  --> $DIR/copies.rs:238:15
+   |
+LL |         42 => foo(),
+   |               ^^^^^
+
+error: this `match` has identical arm bodies
+  --> $DIR/copies.rs:245:17
+   |
+LL |         None => 24, //~ ERROR match arms have same body
+   |                 ^^
+   |
+note: same as this
+  --> $DIR/copies.rs:244:20
+   |
+LL |         Some(_) => 24,
+   |                    ^^
+note: consider refactoring into `Some(_) | None`
+  --> $DIR/copies.rs:244:20
+   |
+LL |         Some(_) => 24,
+   |                    ^^
+
+error: this `match` has identical arm bodies
+  --> $DIR/copies.rs:267:28
+   |
+LL |         (None, Some(a)) => bar(a), //~ ERROR match arms have same body
+   |                            ^^^^^^
+   |
+note: same as this
+  --> $DIR/copies.rs:266:28
+   |
+LL |         (Some(a), None) => bar(a),
+   |                            ^^^^^^
+note: consider refactoring into `(Some(a), None) | (None, Some(a))`
+  --> $DIR/copies.rs:266:28
+   |
+LL |         (Some(a), None) => bar(a),
+   |                            ^^^^^^
+
+error: this `match` has identical arm bodies
+  --> $DIR/copies.rs:273:26
+   |
+LL |         (.., Some(a)) => bar(a), //~ ERROR match arms have same body
+   |                          ^^^^^^
+   |
+note: same as this
+  --> $DIR/copies.rs:272:26
+   |
+LL |         (Some(a), ..) => bar(a),
+   |                          ^^^^^^
+note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
+  --> $DIR/copies.rs:272:26
+   |
+LL |         (Some(a), ..) => bar(a),
+   |                          ^^^^^^
+
+error: this `match` has identical arm bodies
+  --> $DIR/copies.rs:279:20
+   |
+LL |         (.., 3) => 42, //~ ERROR match arms have same body
+   |                    ^^
+   |
+note: same as this
+  --> $DIR/copies.rs:278:23
+   |
+LL |         (1, .., 3) => 42,
+   |                       ^^
+note: consider refactoring into `(1, .., 3) | (.., 3)`
+  --> $DIR/copies.rs:278:23
+   |
+LL |         (1, .., 3) => 42,
+   |                       ^^
+
+error: this `if` has identical blocks
+  --> $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:283:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         0.0
+LL | |     } else {
+   | |_____^
+
+error: this `if` has identical blocks
+  --> $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:290:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         -0.0
+LL | |     } else {
+   | |_____^
+
+error: this `if` has identical blocks
+  --> $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:303:21
+   |
+LL |       let _ = if true {
+   |  _____________________^
+LL | |         std::f32::NAN
+LL | |     } else {
+   | |_____^
+
+error: this `if` has identical blocks
+  --> $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:321:13
+   |
+LL |       if true {
+   |  _____________^
+LL | |         try!(Ok("foo"));
+LL | |     } else {
+   | |_____^
+
+error: aborting due to 17 previous errors