mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
125 lines
2.8 KiB
Text
125 lines
2.8 KiB
Text
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:20:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | //~ ERROR same body as `if` block
|
|
LL | | for _ in &[42] {
|
|
LL | | let foo: &Option<_> = &Some::<u8>(42);
|
|
... |
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:11: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/if_same_then_else2.rs:34:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | //~ ERROR same body as `if` block
|
|
LL | | if let Some(a) = Some(42) {}
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:32:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | | if let Some(a) = Some(42) {}
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:41:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | //~ ERROR same body as `if` block
|
|
LL | | if let (1, .., 3) = (1, 2, 3) {}
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:39:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | | if let (1, .., 3) = (1, 2, 3) {}
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:91:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | //~ ERROR same body as `if` block
|
|
LL | | std::f32::NAN
|
|
LL | | };
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:89:21
|
|
|
|
|
LL | let _ = if true {
|
|
| _____________________^
|
|
LL | | std::f32::NAN
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:98:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | //~ ERROR same body as `if` block
|
|
LL | | Ok("foo")?;
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:96:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | | Ok("foo")?;
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:123:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | let foo = "";
|
|
LL | | return Ok(&foo[0..]);
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:120:20
|
|
|
|
|
LL | } else if true {
|
|
| ____________________^
|
|
LL | | let foo = "";
|
|
LL | | return Ok(&foo[0..]);
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
error: aborting due to 6 previous errors
|
|
|