2018-02-08 13:26:50 -06:00
|
|
|
error: this `if` has identical blocks
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/copies.rs:50:12
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | } else {
|
2018-12-09 23:27:19 -06:00
|
|
|
| ____________^
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | Foo { bar: 42 };
|
|
|
|
LL | | 0..10;
|
2018-02-08 13:26:50 -06:00
|
|
|
... |
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | | foo();
|
|
|
|
LL | | }
|
2018-02-08 13:26:50 -06:00
|
|
|
| |_____^
|
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-09 23:27:19 -06:00
|
|
|
--> $DIR/copies.rs:42:13
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | if true {
|
2018-02-08 13:26:50 -06:00
|
|
|
| _____________^
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | | Foo { bar: 42 };
|
|
|
|
LL | | 0..10;
|
|
|
|
LL | | ..;
|
2018-02-08 13:26:50 -06:00
|
|
|
... |
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | | foo();
|
|
|
|
LL | | } else {
|
2018-02-08 13:26:50 -06:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error: this `match` has identical arm bodies
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $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`
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:87:15
|
|
|
|
|
|
|
|
|
LL | 42 => {
|
|
|
|
| _______________^
|
|
|
|
LL | | foo();
|
|
|
|
LL | | let mut a = 42 + [23].len() as i32;
|
|
|
|
LL | | if true {
|
|
|
|
... |
|
|
|
|
LL | | a
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
2018-02-08 13:26:50 -06:00
|
|
|
note: `42` has the same arm body as the `_` wildcard, consider removing it`
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:87:15
|
|
|
|
|
|
|
|
|
LL | 42 => {
|
|
|
|
| _______________^
|
|
|
|
LL | | foo();
|
|
|
|
LL | | let mut a = 42 + [23].len() as i32;
|
|
|
|
LL | | if true {
|
|
|
|
... |
|
|
|
|
LL | | a
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `match` has identical arm bodies
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:111:14
|
|
|
|
|
|
|
|
|
LL | _ => 0, //~ ERROR match arms have same body
|
|
|
|
| ^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:109:19
|
|
|
|
|
|
|
|
|
LL | Abc::A => 0,
|
|
|
|
| ^
|
2018-02-08 13:26:50 -06:00
|
|
|
note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:109:19
|
|
|
|
|
|
|
|
|
LL | Abc::A => 0,
|
|
|
|
| ^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:120:12
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | 42
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:118:21
|
|
|
|
|
|
|
|
|
LL | let _ = if true {
|
|
|
|
| _____________________^
|
|
|
|
LL | | 42
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $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 | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $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 {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $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 | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $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 {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:183:12
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | if let Some(a) = Some(42) {}
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:181:13
|
|
|
|
|
|
|
|
|
LL | if true {
|
|
|
|
| _____________^
|
|
|
|
LL | | if let Some(a) = Some(42) {}
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:190:12
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | if let (1, .., 3) = (1, 2, 3) {}
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:188:13
|
|
|
|
|
|
|
|
|
LL | if true {
|
|
|
|
| _____________^
|
|
|
|
LL | | if let (1, .., 3) = (1, 2, 3) {}
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `match` has identical arm bodies
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:239:15
|
|
|
|
|
|
|
|
|
LL | 51 => foo(), //~ ERROR match arms have same body
|
|
|
|
| ^^^^^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:238:15
|
|
|
|
|
|
|
|
|
LL | 42 => foo(),
|
|
|
|
| ^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
note: consider refactoring into `42 | 51`
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:238:15
|
|
|
|
|
|
|
|
|
LL | 42 => foo(),
|
|
|
|
| ^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `match` has identical arm bodies
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:245:17
|
|
|
|
|
|
|
|
|
LL | None => 24, //~ ERROR match arms have same body
|
|
|
|
| ^^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:244:20
|
|
|
|
|
|
|
|
|
LL | Some(_) => 24,
|
|
|
|
| ^^
|
2018-02-08 13:26:50 -06:00
|
|
|
note: consider refactoring into `Some(_) | None`
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:244:20
|
|
|
|
|
|
|
|
|
LL | Some(_) => 24,
|
|
|
|
| ^^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `match` has identical arm bodies
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:267:28
|
|
|
|
|
|
|
|
|
LL | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:266:28
|
|
|
|
|
|
|
|
|
LL | (Some(a), None) => bar(a),
|
|
|
|
| ^^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
note: consider refactoring into `(Some(a), None) | (None, Some(a))`
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:266:28
|
|
|
|
|
|
|
|
|
LL | (Some(a), None) => bar(a),
|
|
|
|
| ^^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `match` has identical arm bodies
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:273:26
|
|
|
|
|
|
|
|
|
LL | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:272:26
|
|
|
|
|
|
|
|
|
LL | (Some(a), ..) => bar(a),
|
|
|
|
| ^^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:272:26
|
|
|
|
|
|
|
|
|
LL | (Some(a), ..) => bar(a),
|
|
|
|
| ^^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `match` has identical arm bodies
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:279:20
|
|
|
|
|
|
|
|
|
LL | (.., 3) => 42, //~ ERROR match arms have same body
|
|
|
|
| ^^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:278:23
|
|
|
|
|
|
|
|
|
LL | (1, .., 3) => 42,
|
|
|
|
| ^^
|
2018-02-08 13:26:50 -06:00
|
|
|
note: consider refactoring into `(1, .., 3) | (.., 3)`
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:278:23
|
|
|
|
|
|
|
|
|
LL | (1, .., 3) => 42,
|
|
|
|
| ^^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:285:12
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | 0.0
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:283:21
|
|
|
|
|
|
|
|
|
LL | let _ = if true {
|
|
|
|
| _____________________^
|
|
|
|
LL | | 0.0
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:292:12
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | -0.0
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:290:21
|
|
|
|
|
|
|
|
|
LL | let _ = if true {
|
|
|
|
| _____________________^
|
|
|
|
LL | | -0.0
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:305:12
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | std::f32::NAN
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:303:21
|
|
|
|
|
|
|
|
|
LL | let _ = if true {
|
|
|
|
| _____________________^
|
|
|
|
LL | | std::f32::NAN
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has identical blocks
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:323:12
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ____________^
|
|
|
|
LL | | //~ ERROR same body as `if` block
|
|
|
|
LL | | try!(Ok("foo"));
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 09:57:55 -06:00
|
|
|
--> $DIR/copies.rs:321:13
|
|
|
|
|
|
|
|
|
LL | if true {
|
|
|
|
| _____________^
|
|
|
|
LL | | try!(Ok("foo"));
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has the same condition as a previous if
|
2018-12-27 11:11:25 -06:00
|
|
|
--> $DIR/copies.rs:358:15
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | } else if b {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 11:11:25 -06:00
|
|
|
--> $DIR/copies.rs:357:8
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | if b {
|
|
|
|
| ^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has the same condition as a previous if
|
2018-12-27 11:11:25 -06:00
|
|
|
--> $DIR/copies.rs:363:15
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | } else if a == 1 {
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 11:11:25 -06:00
|
|
|
--> $DIR/copies.rs:362:8
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | if a == 1 {
|
|
|
|
| ^^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
|
|
|
error: this `if` has the same condition as a previous if
|
2018-12-27 11:11:25 -06:00
|
|
|
--> $DIR/copies.rs:369:15
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | } else if 2 * a == 1 {
|
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
2018-02-08 13:26:50 -06:00
|
|
|
note: same as this
|
2018-12-27 11:11:25 -06:00
|
|
|
--> $DIR/copies.rs:367:8
|
2018-12-27 09:57:55 -06:00
|
|
|
|
|
|
|
|
LL | if 2 * a == 1 {
|
|
|
|
| ^^^^^^^^^^
|
2018-02-08 13:26:50 -06:00
|
|
|
|
2018-02-09 08:23:51 -06:00
|
|
|
error: aborting due to 20 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|