error: this `if` has identical blocks
- --> $DIR/copies.rs:41:10
+ --> $DIR/copies.rs:50:12
|
-41 | else { //~ ERROR same body as `if` block
- | __________^
-42 | | Foo { bar: 42 };
-43 | | 0..10;
-44 | | ..;
+LL | } else {
+ | ____________^
+LL | | //~ ERROR same body as `if` block
+LL | | Foo { bar: 42 };
+LL | | 0..10;
... |
-48 | | foo();
-49 | | }
+LL | | foo();
+LL | | }
| |_____^
|
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
note: same as this
- --> $DIR/copies.rs:32:13
+ --> $DIR/copies.rs:42:13
|
-32 | if true {
+LL | if true {
| _____________^
-33 | | Foo { bar: 42 };
-34 | | 0..10;
-35 | | ..;
+LL | | Foo { bar: 42 };
+LL | | 0..10;
+LL | | ..;
... |
-39 | | foo();
-40 | | }
+LL | | foo();
+LL | | } else {
| |_____^
error: this `match` has identical arm bodies
- --> $DIR/copies.rs:90:14
+ --> $DIR/copies.rs:96:14
|
-90 | _ => { //~ ERROR match arms have same body
+LL | _ => {
| ______________^
-91 | | foo();
-92 | | let mut a = 42 + [23].len() as i32;
-93 | | if true {
+LL | | //~ ERROR match arms have same body
+LL | | foo();
+LL | | let mut a = 42 + [23].len() as i32;
... |
-97 | | a
-98 | | }
+LL | | a
+LL | | },
| |_________^
|
= note: `-D clippy::match-same-arms` implied by `-D warnings`
note: same as this
- --> $DIR/copies.rs:81:15
+ --> $DIR/copies.rs:87:15
|
-81 | 42 => {
+LL | 42 => {
| _______________^
-82 | | foo();
-83 | | let mut a = 42 + [23].len() as i32;
-84 | | if true {
+LL | | foo();
+LL | | let mut a = 42 + [23].len() as i32;
+LL | | if true {
... |
-88 | | a
-89 | | }
+LL | | a
+LL | | },
| |_________^
note: `42` has the same arm body as the `_` wildcard, consider removing it`
- --> $DIR/copies.rs:81:15
+ --> $DIR/copies.rs:87:15
|
-81 | 42 => {
+LL | 42 => {
| _______________^
-82 | | foo();
-83 | | let mut a = 42 + [23].len() as i32;
-84 | | if true {
+LL | | foo();
+LL | | let mut a = 42 + [23].len() as i32;
+LL | | if true {
... |
-88 | | a
-89 | | }
+LL | | a
+LL | | },
| |_________^
error: this `match` has identical arm bodies
- --> $DIR/copies.rs:104:14
- |
-104 | _ => 0, //~ ERROR match arms have same body
- | ^
- |
+ --> $DIR/copies.rs:111:14
+ |
+LL | _ => 0, //~ ERROR match arms have same body
+ | ^
+ |
note: same as this
- --> $DIR/copies.rs:102:19
- |
-102 | 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:102:19
- |
-102 | Abc::A => 0,
- | ^
+ --> $DIR/copies.rs:109:19
+ |
+LL | Abc::A => 0,
+ | ^
error: this `if` has identical blocks
- --> $DIR/copies.rs:114:10
- |
-114 | else { //~ ERROR same body as `if` block
- | __________^
-115 | | 42
-116 | | };
- | |_____^
- |
+ --> $DIR/copies.rs:120:12
+ |
+LL | } else {
+ | ____________^
+LL | | //~ ERROR same body as `if` block
+LL | | 42
+LL | | };
+ | |_____^
+ |
note: same as this
- --> $DIR/copies.rs:111:21
- |
-111 | let _ = if true {
- | _____________________^
-112 | | 42
-113 | | }
- | |_____^
+ --> $DIR/copies.rs:118:21
+ |
+LL | let _ = if true {
+ | _____________________^
+LL | | 42
+LL | | } else {
+ | |_____^
error: this `if` has identical blocks
- --> $DIR/copies.rs:128:10
- |
-128 | else { //~ ERROR same body as `if` block
- | __________^
-129 | | for _ in &[42] {
-130 | | let foo: &Option<_> = &Some::<u8>(42);
-131 | | if true {
-... |
-136 | | }
-137 | | }
- | |_____^
- |
+ --> $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:118:13
- |
-118 | if true {
- | _____________^
-119 | | for _ in &[42] {
-120 | | let foo: &Option<_> = &Some::<u8>(42);
-121 | | if true {
-... |
-126 | | }
-127 | | }
- | |_____^
+ --> $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:150:10
- |
-150 | else { //~ ERROR same body as `if` block
- | __________^
-151 | | let bar = if true {
-152 | | 42
-153 | | }
-... |
-159 | | bar + 1;
-160 | | }
- | |_____^
- |
+ --> $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:139:13
- |
-139 | if true {
- | _____________^
-140 | | let bar = if true {
-141 | | 42
-142 | | }
-... |
-148 | | bar + 1;
-149 | | }
- | |_____^
+ --> $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:185:10
- |
-185 | else { //~ ERROR same body as `if` block
- | __________^
-186 | | if let Some(a) = Some(42) {}
-187 | | }
- | |_____^
- |
+ --> $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:182:13
- |
-182 | if true {
- | _____________^
-183 | | if let Some(a) = Some(42) {}
-184 | | }
- | |_____^
+ --> $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:192:10
- |
-192 | else { //~ ERROR same body as `if` block
- | __________^
-193 | | if let (1, .., 3) = (1, 2, 3) {}
-194 | | }
- | |_____^
- |
+ --> $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:189:13
- |
-189 | if true {
- | _____________^
-190 | | if let (1, .., 3) = (1, 2, 3) {}
-191 | | }
- | |_____^
+ --> $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:247:15
- |
-247 | 51 => foo(), //~ ERROR match arms have same body
- | ^^^^^
- |
+ --> $DIR/copies.rs:239:15
+ |
+LL | 51 => foo(), //~ ERROR match arms have same body
+ | ^^^^^
+ |
note: same as this
- --> $DIR/copies.rs:246:15
- |
-246 | 42 => foo(),
- | ^^^^^
+ --> $DIR/copies.rs:238:15
+ |
+LL | 42 => foo(),
+ | ^^^^^
note: consider refactoring into `42 | 51`
- --> $DIR/copies.rs:246:15
- |
-246 | 42 => foo(),
- | ^^^^^
+ --> $DIR/copies.rs:238:15
+ |
+LL | 42 => foo(),
+ | ^^^^^
error: this `match` has identical arm bodies
- --> $DIR/copies.rs:253:17
- |
-253 | None => 24, //~ ERROR match arms have same body
- | ^^
- |
+ --> $DIR/copies.rs:245:17
+ |
+LL | None => 24, //~ ERROR match arms have same body
+ | ^^
+ |
note: same as this
- --> $DIR/copies.rs:252:20
- |
-252 | Some(_) => 24,
- | ^^
+ --> $DIR/copies.rs:244:20
+ |
+LL | Some(_) => 24,
+ | ^^
note: consider refactoring into `Some(_) | None`
- --> $DIR/copies.rs:252:20
- |
-252 | Some(_) => 24,
- | ^^
+ --> $DIR/copies.rs:244:20
+ |
+LL | Some(_) => 24,
+ | ^^
error: this `match` has identical arm bodies
- --> $DIR/copies.rs:275:28
- |
-275 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
- | ^^^^^^
- |
+ --> $DIR/copies.rs:267:28
+ |
+LL | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
+ | ^^^^^^
+ |
note: same as this
- --> $DIR/copies.rs:274:28
- |
-274 | (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:274:28
- |
-274 | (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:281:26
- |
-281 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
- | ^^^^^^
- |
+ --> $DIR/copies.rs:273:26
+ |
+LL | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
+ | ^^^^^^
+ |
note: same as this
- --> $DIR/copies.rs:280:26
- |
-280 | (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:280:26
- |
-280 | (Some(a), ..) => bar(a),
- | ^^^^^^
+ --> $DIR/copies.rs:272:26
+ |
+LL | (Some(a), ..) => bar(a),
+ | ^^^^^^
error: this `match` has identical arm bodies
- --> $DIR/copies.rs:287:20
- |
-287 | (.., 3) => 42, //~ ERROR match arms have same body
- | ^^
- |
+ --> $DIR/copies.rs:279:20
+ |
+LL | (.., 3) => 42, //~ ERROR match arms have same body
+ | ^^
+ |
note: same as this
- --> $DIR/copies.rs:286:23
- |
-286 | (1, .., 3) => 42,
- | ^^
+ --> $DIR/copies.rs:278:23
+ |
+LL | (1, .., 3) => 42,
+ | ^^
note: consider refactoring into `(1, .., 3) | (.., 3)`
- --> $DIR/copies.rs:286:23
- |
-286 | (1, .., 3) => 42,
- | ^^
+ --> $DIR/copies.rs:278:23
+ |
+LL | (1, .., 3) => 42,
+ | ^^
error: this `if` has identical blocks
- --> $DIR/copies.rs:293:12
- |
-293 | } else { //~ ERROR same body as `if` block
- | ____________^
-294 | | 0.0
-295 | | };
- | |_____^
- |
+ --> $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:291:21
- |
-291 | let _ = if true {
- | _____________________^
-292 | | 0.0
-293 | | } else { //~ ERROR same body as `if` block
- | |_____^
+ --> $DIR/copies.rs:283:21
+ |
+LL | let _ = if true {
+ | _____________________^
+LL | | 0.0
+LL | | } else {
+ | |_____^
error: this `if` has identical blocks
- --> $DIR/copies.rs:299:12
- |
-299 | } else { //~ ERROR same body as `if` block
- | ____________^
-300 | | -0.0
-301 | | };
- | |_____^
- |
+ --> $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:297:21
- |
-297 | let _ = if true {
- | _____________________^
-298 | | -0.0
-299 | | } else { //~ ERROR same body as `if` block
- | |_____^
+ --> $DIR/copies.rs:290:21
+ |
+LL | let _ = if true {
+ | _____________________^
+LL | | -0.0
+LL | | } else {
+ | |_____^
error: this `if` has identical blocks
- --> $DIR/copies.rs:319:12
- |
-319 | } else { //~ ERROR same body as `if` block
- | ____________^
-320 | | std::f32::NAN
-321 | | };
- | |_____^
- |
+ --> $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:317:21
- |
-317 | let _ = if true {
- | _____________________^
-318 | | std::f32::NAN
-319 | | } else { //~ ERROR same body as `if` block
- | |_____^
+ --> $DIR/copies.rs:303:21
+ |
+LL | let _ = if true {
+ | _____________________^
+LL | | std::f32::NAN
+LL | | } else {
+ | |_____^
error: this `if` has identical blocks
- --> $DIR/copies.rs:337:10
- |
-337 | else { //~ ERROR same body as `if` block
- | __________^
-338 | | try!(Ok("foo"));
-339 | | }
- | |_____^
- |
-note: same as this
- --> $DIR/copies.rs:334:13
- |
-334 | if true {
- | _____________^
-335 | | try!(Ok("foo"));
-336 | | }
- | |_____^
-
-error: this `if` has the same condition as a previous if
- --> $DIR/copies.rs:363:13
- |
-363 | else if b { //~ ERROR ifs same condition
- | ^
- |
- = note: `-D clippy::ifs-same-cond` implied by `-D warnings`
-note: same as this
- --> $DIR/copies.rs:361:8
- |
-361 | if b {
- | ^
-
-error: this `if` has the same condition as a previous if
- --> $DIR/copies.rs:368:13
- |
-368 | else if a == 1 { //~ ERROR ifs same condition
- | ^^^^^^
- |
-note: same as this
- --> $DIR/copies.rs:366:8
- |
-366 | if a == 1 {
- | ^^^^^^
-
-error: this `if` has the same condition as a previous if
- --> $DIR/copies.rs:375:13
- |
-375 | else if 2*a == 1 { //~ ERROR ifs same condition
- | ^^^^^^^^
- |
+ --> $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:371:8
- |
-371 | if 2*a == 1 {
- | ^^^^^^^^
+ --> $DIR/copies.rs:321:13
+ |
+LL | if true {
+ | _____________^
+LL | | try!(Ok("foo"));
+LL | | } else {
+ | |_____^
-error: aborting due to 20 previous errors
+error: aborting due to 17 previous errors