mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 09:03:18 +00:00
127 lines
2.6 KiB
Text
127 lines
2.6 KiB
Text
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:15:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | |
|
|
LL | | for _ in &[42] {
|
|
LL | | let foo: &Option<_> = &Some::<u8>(42);
|
|
... |
|
|
LL | | }
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:25:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | for _ in &[42] {
|
|
LL | | let bar: &Option<_> = &Some::<u8>(42);
|
|
LL | | if bar.is_some() {
|
|
... |
|
|
LL | | }
|
|
LL | | }
|
|
| |_____^
|
|
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::if_same_then_else)]`
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:36:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | |
|
|
LL | | if let Some(a) = Some(42) {}
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:39:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if let Some(a) = Some(42) {}
|
|
LL | | }
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:43:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | |
|
|
LL | | if let (1, .., 3) = (1, 2, 3) {}
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:46:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | if let (1, .., 3) = (1, 2, 3) {}
|
|
LL | | }
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:93:21
|
|
|
|
|
LL | let _ = if true {
|
|
| _____________________^
|
|
LL | |
|
|
LL | | f32::NAN
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:96:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | f32::NAN
|
|
LL | | };
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:100:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | |
|
|
LL | | Ok("foo")?;
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:103:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | Ok("foo")?;
|
|
LL | | }
|
|
| |_____^
|
|
|
|
error: this `if` has identical blocks
|
|
--> $DIR/if_same_then_else2.rs:124:20
|
|
|
|
|
LL | } else if true {
|
|
| ____________________^
|
|
LL | |
|
|
LL | | let foo = "";
|
|
LL | | return Ok(&foo[0..]);
|
|
LL | | } else {
|
|
| |_____^
|
|
|
|
|
note: same as this
|
|
--> $DIR/if_same_then_else2.rs:128:12
|
|
|
|
|
LL | } else {
|
|
| ____________^
|
|
LL | | let foo = "";
|
|
LL | | return Ok(&foo[0..]);
|
|
LL | | }
|
|
| |_____^
|
|
|
|
error: aborting due to 6 previous errors
|
|
|