rust-clippy/tests/ui/copies.stderr

480 lines
10 KiB
Text
Raw Normal View History

2017-04-11 14:19:27 +00:00
warning: This else block is redundant.
--> $DIR/copies.rs:121:20
2017-04-11 14:19:27 +00:00
|
121 | } else {
| ____________________^
122 | | continue;
123 | | }
| |_____________^
2017-04-11 14:19:27 +00:00
|
= note: #[warn(needless_continue)] on by default
= 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...
2017-04-11 14:19:27 +00:00
}
warning: This else block is redundant.
--> $DIR/copies.rs:131:20
2017-04-11 14:19:27 +00:00
|
131 | } else {
| ____________________^
132 | | continue;
133 | | }
| |_____________^
2017-04-11 14:19:27 +00:00
|
= note: #[warn(needless_continue)] on by default
= 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...
2017-04-11 14:19:27 +00:00
}
error: this `if` has identical blocks
--> $DIR/copies.rs:39:10
|
39 | else {
| __________^
40 | | Foo { bar: 42 };
41 | | 0..10;
42 | | ..;
... |
46 | | foo();
47 | | }
| |_____^
|
note: lint level defined here
--> $DIR/copies.rs:27:8
|
27 | #[deny(if_same_then_else)]
| ^^^^^^^^^^^^^^^^^
note: same as this
--> $DIR/copies.rs:30:13
|
30 | if true {
| _____________^
31 | | Foo { bar: 42 };
32 | | 0..10;
33 | | ..;
... |
37 | | foo();
38 | | }
| |_____^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:88:14
|
88 | _ => {
| ______________^
89 | | foo();
90 | | let mut a = 42 + [23].len() as i32;
91 | | if true {
... |
95 | | a
96 | | }
| |_________^
|
note: lint level defined here
--> $DIR/copies.rs:28:8
|
28 | #[deny(match_same_arms)]
| ^^^^^^^^^^^^^^^
note: same as this
--> $DIR/copies.rs:79:15
|
79 | 42 => {
| _______________^
80 | | foo();
81 | | let mut a = 42 + [23].len() as i32;
82 | | if true {
... |
86 | | a
87 | | }
| |_________^
note: `42` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:79:15
|
79 | 42 => {
| _______________^
80 | | foo();
81 | | let mut a = 42 + [23].len() as i32;
82 | | if true {
... |
86 | | a
87 | | }
| |_________^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:102:14
|
102 | _ => 0,
| ^
|
note: same as this
--> $DIR/copies.rs:100:19
|
100 | Abc::A => 0,
| ^
note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it`
--> $DIR/copies.rs:100:19
|
100 | Abc::A => 0,
| ^
error: this `if` has identical blocks
--> $DIR/copies.rs:112:10
|
112 | else {
| __________^
113 | | 42
114 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:109:21
|
109 | let _ = if true {
| _____________________^
110 | | 42
111 | | }
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:126:10
|
126 | else {
| __________^
127 | | for _ in &[42] {
128 | | let foo: &Option<_> = &Some::<u8>(42);
129 | | if true {
... |
134 | | }
135 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:116:13
|
116 | if true {
| _____________^
117 | | for _ in &[42] {
118 | | let foo: &Option<_> = &Some::<u8>(42);
119 | | if true {
... |
124 | | }
125 | | }
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:148:10
|
148 | else {
| __________^
149 | | let bar = if true {
150 | | 42
151 | | }
... |
157 | | bar + 1;
158 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:137:13
|
137 | if true {
| _____________^
138 | | let bar = if true {
139 | | 42
140 | | }
... |
146 | | bar + 1;
147 | | }
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:171:19
|
171 | else if foo() {
| ___________________^
172 | | let _ = match 42 {
173 | | 42 => 1,
174 | | a if a > 0 => 2,
... |
177 | | };
178 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:160:13
|
160 | if true {
| _____________^
161 | | let _ = match 42 {
162 | | 42 => 1,
163 | | a if a > 0 => 2,
... |
166 | | };
167 | | }
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:183:10
|
183 | else {
| __________^
184 | | if let Some(a) = Some(42) {}
185 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:180:13
|
180 | if true {
| _____________^
181 | | if let Some(a) = Some(42) {}
182 | | }
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:190:10
|
190 | else {
| __________^
191 | | if let (1, .., 3) = (1, 2, 3) {}
192 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:187:13
|
187 | if true {
| _____________^
188 | | if let (1, .., 3) = (1, 2, 3) {}
189 | | }
| |_____^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:245:15
|
245 | 51 => foo(),
| ^^^^^
|
note: same as this
--> $DIR/copies.rs:244:15
|
244 | 42 => foo(),
| ^^^^^
note: consider refactoring into `42 | 51`
--> $DIR/copies.rs:244:15
|
244 | 42 => foo(),
| ^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:251:17
|
251 | None => 24,
| ^^
|
note: same as this
--> $DIR/copies.rs:250:20
|
250 | Some(_) => 24,
| ^^
note: consider refactoring into `Some(_) | None`
--> $DIR/copies.rs:250:20
|
250 | Some(_) => 24,
| ^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:273:28
|
273 | (None, Some(a)) => bar(a),
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:272:28
|
272 | (Some(a), None) => bar(a),
| ^^^^^^
note: consider refactoring into `(Some(a), None) | (None, Some(a))`
--> $DIR/copies.rs:272:28
|
272 | (Some(a), None) => bar(a),
| ^^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:279:26
|
279 | (.., Some(a)) => bar(a),
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:278:26
|
278 | (Some(a), ..) => bar(a),
| ^^^^^^
note: consider refactoring into `(Some(a), ..) | (.., Some(a))`
--> $DIR/copies.rs:278:26
|
278 | (Some(a), ..) => bar(a),
| ^^^^^^
error: this `match` has identical arm bodies
--> $DIR/copies.rs:285:20
|
285 | (.., 3) => 42,
| ^^
|
note: same as this
--> $DIR/copies.rs:284:23
|
284 | (1, .., 3) => 42,
| ^^
note: consider refactoring into `(1, .., 3) | (.., 3)`
--> $DIR/copies.rs:284:23
|
284 | (1, .., 3) => 42,
| ^^
error: this `if` has identical blocks
--> $DIR/copies.rs:291:12
|
291 | } else {
| ____________^
292 | | 0.0
293 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:289:21
|
289 | let _ = if true {
| _____________________^
290 | | 0.0
291 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:297:12
|
297 | } else {
| ____________^
298 | | -0.0
299 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:295:21
|
295 | let _ = if true {
| _____________________^
296 | | -0.0
297 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:317:12
|
317 | } else {
| ____________^
318 | | std::f32::NAN
319 | | };
| |_____^
|
note: same as this
--> $DIR/copies.rs:315:21
|
315 | let _ = if true {
| _____________________^
316 | | std::f32::NAN
317 | | } else {
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:335:10
|
335 | else {
| __________^
336 | | try!(Ok("foo"));
337 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:332:13
|
332 | if true {
| _____________^
333 | | try!(Ok("foo"));
334 | | }
| |_____^
error: this `if` has identical blocks
--> $DIR/copies.rs:347:10
|
347 | else {
| __________^
348 | | let foo = "";
349 | | return Ok(&foo[0..]);
350 | | }
| |_____^
|
note: same as this
--> $DIR/copies.rs:339:13
|
339 | if true {
| _____________^
340 | | let foo = "";
341 | | return Ok(&foo[0..]);
342 | | }
| |_____^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:361:13
|
361 | else if b {
| ^
|
note: lint level defined here
--> $DIR/copies.rs:353:8
|
353 | #[deny(ifs_same_cond)]
| ^^^^^^^^^^^^^
note: same as this
--> $DIR/copies.rs:359:8
|
359 | if b {
| ^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:366:13
|
366 | else if a == 1 {
| ^^^^^^
|
note: same as this
--> $DIR/copies.rs:364:8
|
364 | if a == 1 {
| ^^^^^^
error: this `if` has the same condition as a previous if
--> $DIR/copies.rs:373:13
|
373 | else if 2*a == 1 {
| ^^^^^^^^
|
note: same as this
--> $DIR/copies.rs:369:8
|
369 | if 2*a == 1 {
| ^^^^^^^^
error: aborting due to 22 previous errors