mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-24 03:53:20 +00:00
385 lines
8.9 KiB
Text
385 lines
8.9 KiB
Text
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:29:10
|
|
|
|
|
29 | else { //~ ERROR same body as `if` block
|
|
| __________^
|
|
30 | | Foo { bar: 42 };
|
|
31 | | 0..10;
|
|
32 | | ..;
|
|
... |
|
|
36 | | foo();
|
|
37 | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D if-same-then-else` implied by `-D warnings`
|
|
note: same as this
|
|
--> $DIR/copies.rs:20:13
|
|
|
|
|
20 | if true {
|
|
| _____________^
|
|
21 | | Foo { bar: 42 };
|
|
22 | | 0..10;
|
|
23 | | ..;
|
|
... |
|
|
27 | | foo();
|
|
28 | | }
|
|
| |_____^
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/copies.rs:78:14
|
|
|
|
|
78 | _ => { //~ ERROR match arms have same body
|
|
| ______________^
|
|
79 | | foo();
|
|
80 | | let mut a = 42 + [23].len() as i32;
|
|
81 | | if true {
|
|
... |
|
|
85 | | a
|
|
86 | | }
|
|
| |_________^
|
|
|
|
|
= note: `-D match-same-arms` implied by `-D warnings`
|
|
note: same as this
|
|
--> $DIR/copies.rs:69:15
|
|
|
|
|
69 | 42 => {
|
|
| _______________^
|
|
70 | | foo();
|
|
71 | | let mut a = 42 + [23].len() as i32;
|
|
72 | | if true {
|
|
... |
|
|
76 | | a
|
|
77 | | }
|
|
| |_________^
|
|
note: `42` has the same arm body as the `_` wildcard, consider removing it`
|
|
--> $DIR/copies.rs:69:15
|
|
|
|
|
69 | 42 => {
|
|
| _______________^
|
|
70 | | foo();
|
|
71 | | let mut a = 42 + [23].len() as i32;
|
|
72 | | if true {
|
|
... |
|
|
76 | | a
|
|
77 | | }
|
|
| |_________^
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/copies.rs:92:14
|
|
|
|
|
92 | _ => 0, //~ ERROR match arms have same body
|
|
| ^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:90:19
|
|
|
|
|
90 | Abc::A => 0,
|
|
| ^
|
|
note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
|
|
--> $DIR/copies.rs:90:19
|
|
|
|
|
90 | Abc::A => 0,
|
|
| ^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:102:10
|
|
|
|
|
102 | else { //~ ERROR same body as `if` block
|
|
| __________^
|
|
103 | | 42
|
|
104 | | };
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:99:21
|
|
|
|
|
99 | let _ = if true {
|
|
| _____________________^
|
|
100 | | 42
|
|
101 | | }
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:116:10
|
|
|
|
|
116 | else { //~ ERROR same body as `if` block
|
|
| __________^
|
|
117 | | for _ in &[42] {
|
|
118 | | let foo: &Option<_> = &Some::<u8>(42);
|
|
119 | | if true {
|
|
... |
|
|
124 | | }
|
|
125 | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:106:13
|
|
|
|
|
106 | if true {
|
|
| _____________^
|
|
107 | | for _ in &[42] {
|
|
108 | | let foo: &Option<_> = &Some::<u8>(42);
|
|
109 | | if true {
|
|
... |
|
|
114 | | }
|
|
115 | | }
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:138:10
|
|
|
|
|
138 | else { //~ ERROR same body as `if` block
|
|
| __________^
|
|
139 | | let bar = if true {
|
|
140 | | 42
|
|
141 | | }
|
|
... |
|
|
147 | | bar + 1;
|
|
148 | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:127:13
|
|
|
|
|
127 | if true {
|
|
| _____________^
|
|
128 | | let bar = if true {
|
|
129 | | 42
|
|
130 | | }
|
|
... |
|
|
136 | | bar + 1;
|
|
137 | | }
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:173:10
|
|
|
|
|
173 | else { //~ ERROR same body as `if` block
|
|
| __________^
|
|
174 | | if let Some(a) = Some(42) {}
|
|
175 | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:170:13
|
|
|
|
|
170 | if true {
|
|
| _____________^
|
|
171 | | if let Some(a) = Some(42) {}
|
|
172 | | }
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:180:10
|
|
|
|
|
180 | else { //~ ERROR same body as `if` block
|
|
| __________^
|
|
181 | | if let (1, .., 3) = (1, 2, 3) {}
|
|
182 | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:177:13
|
|
|
|
|
177 | if true {
|
|
| _____________^
|
|
178 | | if let (1, .., 3) = (1, 2, 3) {}
|
|
179 | | }
|
|
| |_____^
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/copies.rs:235:15
|
|
|
|
|
235 | 51 => foo(), //~ ERROR match arms have same body
|
|
| ^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:234:15
|
|
|
|
|
234 | 42 => foo(),
|
|
| ^^^^^
|
|
note: consider refactoring into `42 | 51`
|
|
--> $DIR/copies.rs:234:15
|
|
|
|
|
234 | 42 => foo(),
|
|
| ^^^^^
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/copies.rs:241:17
|
|
|
|
|
241 | None => 24, //~ ERROR match arms have same body
|
|
| ^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:240:20
|
|
|
|
|
240 | Some(_) => 24,
|
|
| ^^
|
|
note: consider refactoring into `Some(_) | None`
|
|
--> $DIR/copies.rs:240:20
|
|
|
|
|
240 | Some(_) => 24,
|
|
| ^^
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/copies.rs:263:28
|
|
|
|
|
263 | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
|
|
| ^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:262:28
|
|
|
|
|
262 | (Some(a), None) => bar(a),
|
|
| ^^^^^^
|
|
note: consider refactoring into `(Some(a), None) | (None, Some(a))`
|
|
--> $DIR/copies.rs:262:28
|
|
|
|
|
262 | (Some(a), None) => bar(a),
|
|
| ^^^^^^
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/copies.rs:269:26
|
|
|
|
|
269 | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
|
|
| ^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:268:26
|
|
|
|
|
268 | (Some(a), ..) => bar(a),
|
|
| ^^^^^^
|
|
note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
|
|
--> $DIR/copies.rs:268:26
|
|
|
|
|
268 | (Some(a), ..) => bar(a),
|
|
| ^^^^^^
|
|
|
|
error: this `match` has identical arm bodies
|
|
--> $DIR/copies.rs:275:20
|
|
|
|
|
275 | (.., 3) => 42, //~ ERROR match arms have same body
|
|
| ^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:274:23
|
|
|
|
|
274 | (1, .., 3) => 42,
|
|
| ^^
|
|
note: consider refactoring into `(1, .., 3) | (.., 3)`
|
|
--> $DIR/copies.rs:274:23
|
|
|
|
|
274 | (1, .., 3) => 42,
|
|
| ^^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:281:12
|
|
|
|
|
281 | } else { //~ ERROR same body as `if` block
|
|
| ____________^
|
|
282 | | 0.0
|
|
283 | | };
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:279:21
|
|
|
|
|
279 | let _ = if true {
|
|
| _____________________^
|
|
280 | | 0.0
|
|
281 | | } else { //~ ERROR same body as `if` block
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:287:12
|
|
|
|
|
287 | } else { //~ ERROR same body as `if` block
|
|
| ____________^
|
|
288 | | -0.0
|
|
289 | | };
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:285:21
|
|
|
|
|
285 | let _ = if true {
|
|
| _____________________^
|
|
286 | | -0.0
|
|
287 | | } else { //~ ERROR same body as `if` block
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:307:12
|
|
|
|
|
307 | } else { //~ ERROR same body as `if` block
|
|
| ____________^
|
|
308 | | std::f32::NAN
|
|
309 | | };
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:305:21
|
|
|
|
|
305 | let _ = if true {
|
|
| _____________________^
|
|
306 | | std::f32::NAN
|
|
307 | | } else { //~ ERROR same body as `if` block
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/copies.rs:325:10
|
|
|
|
|
325 | else { //~ ERROR same body as `if` block
|
|
| __________^
|
|
326 | | try!(Ok("foo"));
|
|
327 | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:322:13
|
|
|
|
|
322 | if true {
|
|
| _____________^
|
|
323 | | try!(Ok("foo"));
|
|
324 | | }
|
|
| |_____^
|
|
|
|
error: this `if` has the same condition as a previous if
|
|
--> $DIR/copies.rs:351:13
|
|
|
|
|
351 | else if b { //~ ERROR ifs same condition
|
|
| ^
|
|
|
|
|
= note: `-D ifs-same-cond` implied by `-D warnings`
|
|
note: same as this
|
|
--> $DIR/copies.rs:349:8
|
|
|
|
|
349 | if b {
|
|
| ^
|
|
|
|
error: this `if` has the same condition as a previous if
|
|
--> $DIR/copies.rs:356:13
|
|
|
|
|
356 | else if a == 1 { //~ ERROR ifs same condition
|
|
| ^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:354:8
|
|
|
|
|
354 | if a == 1 {
|
|
| ^^^^^^
|
|
|
|
error: this `if` has the same condition as a previous if
|
|
--> $DIR/copies.rs:363:13
|
|
|
|
|
363 | else if 2*a == 1 { //~ ERROR ifs same condition
|
|
| ^^^^^^^^
|
|
|
|
|
note: same as this
|
|
--> $DIR/copies.rs:359:8
|
|
|
|
|
359 | if 2*a == 1 {
|
|
| ^^^^^^^^
|
|
|
|
error: aborting due to 20 previous errors
|
|
|