rust/tests/ui/match_single_binding.fixed

27 lines
448 B
Rust
Raw Normal View History

// run-rustfix
#![warn(clippy::match_single_binding)]
#[allow(clippy::many_single_char_names)]
fn main() {
let a = 1;
let b = 2;
let c = 3;
// Lint
let (x, y, z) = (a, b, c);
{
println!("{} {} {}", x, y, z);
}
// Ok
match a {
2 => println!("2"),
_ => println!("Not 2"),
}
// Ok
let d = Some(5);
match d {
Some(d) => println!("{}", d),
_ => println!("None"),
}
}