blob: 8e5934d3693a3e3cad62b4b2bed948a7f99810cf [file] [edit]
#![warn(clippy::collapsible_match)]
#![allow(clippy::single_match, clippy::redundant_guards)]
fn issue16558() {
let opt = Some(1);
let _ = match opt {
Some(s)
if s == 1 => { s }
//~^ collapsible_match
,
_ => 1,
};
match opt {
Some(s)
if s == 1 => {
//~^ collapsible_match
todo!()
},
_ => {},
};
let _ = match opt {
Some(s) if s > 2
&& s == 1 => { s }
//~^ collapsible_match
,
_ => 1,
};
}
// https://github.com/rust-lang/rust-clippy/issues/16875
// lint still fires when only wildcard-like arms follow (fall-through is harmless)
fn issue16875(a: Option<&str>, b: i32) -> i32 {
let mut res = 0;
match a {
Some(_)
if b == 0 => {
//~^ collapsible_match
res = 1;
},
_ => {},
}
res
}