2 #![warn(clippy::needless_match)]
3 #![allow(clippy::manual_map)]
25 fn custom_type_match(se: Choice) {
28 let _: Choice = match se {
29 Choice::A => Choice::A,
30 Choice::B => Choice::B,
33 // Mingled, don't trigger
34 let _: Choice = match se {
35 Choice::A => Choice::B,
36 Choice::B => Choice::C,
37 Choice::C => Choice::D,
38 Choice::D => Choice::A,
42 fn option_match(x: Option<i32>) {
43 let _: Option<i32> = x;
44 // Don't trigger, this is the case for manual_map_option
45 let _: Option<i32> = match x {
51 fn func_ret_err<T>(err: T) -> Result<i32, T> {
56 let _: Result<i32, i32> = Ok(1);
57 let _: Result<i32, i32> = func_ret_err(0_i32);
60 fn if_let_option() -> Option<i32> {
64 fn if_let_result(x: Result<(), i32>) {
65 let _: Result<(), i32> = x;
66 let _: Result<(), i32> = x;
67 // Input type mismatch, don't trigger
68 let _: Result<(), i32> = if let Err(e) = Ok(1) { Err(e) } else { x };
71 fn if_let_custom_enum(x: Choice) {
74 let _: Choice = if let Choice::A = x {