| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:12:9 | |
| | | |
| LL | / 42 => { | |
| LL | | foo(); | |
| LL | | let mut a = 42 + [23].len() as i32; | |
| LL | | if true { | |
| ... | | |
| LL | | a | |
| LL | | }, | |
| | |_________^ | |
| LL | | |
| LL | / _ => { | |
| LL | | foo(); | |
| LL | | let mut a = 42 + [23].len() as i32; | |
| LL | | if true { | |
| ... | | |
| LL | | a | |
| LL | | }, | |
| | |_________^ the wildcard arm | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| = note: `-D clippy::match-same-arms` implied by `-D warnings` | |
| = help: to override `-D warnings` add `#[allow(clippy::match_same_arms)]` | |
| help: otherwise remove the non-wildcard arm | |
| | | |
| LL - 42 => { | |
| LL - foo(); | |
| LL - let mut a = 42 + [23].len() as i32; | |
| LL - if true { | |
| LL - a += 7; | |
| LL - } | |
| LL - a = -31 - a; | |
| LL - a | |
| LL - }, | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:34:9 | |
| | | |
| LL | 42 => foo(), | |
| | ^^^^^^^^^^^ | |
| LL | | |
| LL | 51 => foo(), | |
| | ^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ 42 | 51 => foo(), | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:41:9 | |
| | | |
| LL | Some(_) => 24, | |
| | ^^^^^^^^^^^^^ | |
| LL | | |
| LL | None => 24, | |
| | ^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ Some(_) | None => 24, | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:64:9 | |
| | | |
| LL | (Some(a), None) => bar(a), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| LL | | |
| LL | (None, Some(a)) => bar(a), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ (Some(a), None) | (None, Some(a)) => bar(a), | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:79:9 | |
| | | |
| LL | (Some(a), None) if a == 42 => a, | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| LL | | |
| LL | (None, Some(a)) if a == 42 => a, | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ (Some(a), None) | (None, Some(a)) if a == 42 => a, | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:86:9 | |
| | | |
| LL | (Some(a), ..) => bar(a), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^ | |
| LL | | |
| LL | (.., Some(a)) => bar(a), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ (Some(a), ..) | (.., Some(a)) => bar(a), | |
| LL | | |
| LL ~ _ => (), | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:121:9 | |
| | | |
| LL | (Ok(x), Some(_)) => println!("ok {}", x), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| LL | | |
| LL | (Ok(_), Some(x)) => println!("ok {}", x), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ (Ok(x), Some(_)) | (Ok(_), Some(x)) => println!("ok {}", x), | |
| LL | | |
| LL ~ _ => println!("err"), | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:137:9 | |
| | | |
| LL | Ok(3) => println!("ok"), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^ | |
| LL | | |
| LL | Ok(_) => println!("ok"), | |
| | ^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ Ok(3) | Ok(_) => println!("ok"), | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:163:9 | |
| | | |
| LL | / 0 => { | |
| LL | | empty!(0); | |
| LL | | }, | |
| | |_________^ | |
| LL | | |
| LL | / 1 => { | |
| LL | | empty!(0); | |
| LL | | }, | |
| | |_________^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ 0 | 1 => { | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:217:9 | |
| | | |
| LL | Foo::X(0) => 1, | |
| | ^^^^^^^^^^^^^^ | |
| ... | |
| LL | Foo::Z(_) => 1, | |
| | ^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ Foo::X(0) | Foo::Z(_) => 1, | |
| LL | | |
| LL | Foo::X(_) | Foo::Y(_) => 2, | |
| LL ~ _ => 0, | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:226:9 | |
| | | |
| LL | Foo::X(0) => 1, | |
| | ^^^^^^^^^^^^^^ | |
| ... | |
| LL | Foo::Z(_) => 1, | |
| | ^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL | Foo::Y(_) | Foo::Z(0) => 2, | |
| LL ~ Foo::X(0) | Foo::Z(_) => 1, | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:249:9 | |
| | | |
| LL | Some(Bar { x: 0, y: 5, .. }) => 1, | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| ... | |
| LL | Some(Bar { y: 0, x: 5, .. }) => 1, | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL | Some(Bar { y: 10, z: 0, .. }) => 2, | |
| LL | None => 50, | |
| LL ~ Some(Bar { x: 0, y: 5, .. }) | Some(Bar { y: 0, x: 5, .. }) => 1, | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:266:9 | |
| | | |
| LL | 0 => cfg!(not_enable), | |
| | ^^^^^^^^^^^^^^^^^^^^^ | |
| LL | | |
| LL | 1 => cfg!(not_enable), | |
| | ^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ 0 | 1 => cfg!(not_enable), | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:283:17 | |
| | | |
| LL | MaybeStaticStr::Static(s) => s, | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| LL | | |
| LL | MaybeStaticStr::Borrowed(s) => s, | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ | |
| LL ~ MaybeStaticStr::Static(s) | MaybeStaticStr::Borrowed(s) => s, | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:301:9 | |
| | | |
| LL | 1 => "b", | |
| | ^^^^^^^^ | |
| LL | | |
| LL | 2 => "b", | |
| | ^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ 1 | 2 => "b", | |
| LL | | |
| LL ~ #[allow(clippy::match_same_arms)] | |
| | | |
| error: these match arms have identical bodies | |
| --> tests/ui/match_same_arms2.rs:310:9 | |
| | | |
| LL | 1 => "b", | |
| | ^^^^^^^^ | |
| LL | | |
| LL | 2 => "b", | |
| | ^^^^^^^^ | |
| | | |
| = help: if this is unintentional make the arms return different values | |
| help: otherwise merge the patterns into a single arm | |
| | | |
| LL ~ 1 | 2 => "b", | |
| LL | | |
| LL ~ #[expect(clippy::match_same_arms)] | |
| | | |
| error: aborting due to 16 previous errors | |