2 #![warn(clippy::needless_match)]
3 #![allow(clippy::manual_map)]
17 let _: i32 = match i {
23 let _: i32 = match i {
28 let mut _i_mut = match i {
35 let _: &str = match s {
42 fn custom_type_match(se: Choice) {
43 let _: Choice = match se {
44 Choice::A => Choice::A,
45 Choice::B => Choice::B,
46 Choice::C => Choice::C,
47 Choice::D => Choice::D,
50 let _: Choice = match se {
51 Choice::A => Choice::A,
52 Choice::B => Choice::B,
55 // Mingled, don't trigger
56 let _: Choice = match se {
57 Choice::A => Choice::B,
58 Choice::B => Choice::C,
59 Choice::C => Choice::D,
60 Choice::D => Choice::A,
64 fn option_match(x: Option<i32>) {
65 let _: Option<i32> = match x {
69 // Don't trigger, this is the case for manual_map_option
70 let _: Option<i32> = match x {
76 fn func_ret_err<T>(err: T) -> Result<i32, T> {
81 let _: Result<i32, i32> = match Ok(1) {
85 let _: Result<i32, i32> = match func_ret_err(0_i32) {
91 fn if_let_option() -> Option<i32> {
92 if let Some(a) = Some(1) { Some(a) } else { None }
95 fn if_let_result(x: Result<(), i32>) {
96 let _: Result<(), i32> = if let Err(e) = x { Err(e) } else { x };
97 let _: Result<(), i32> = if let Ok(val) = x { Ok(val) } else { x };
98 // Input type mismatch, don't trigger
99 let _: Result<(), i32> = if let Err(e) = Ok(1) { Err(e) } else { x };
102 fn if_let_custom_enum(x: Choice) {
103 let _: Choice = if let Choice::A = x {
105 } else if let Choice::B = x {
107 } else if let Choice::C = x {
113 let _: Choice = if let Choice::A = x {