2020-05-09 16:08:41 -05:00
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
#![warn(clippy::match_wildcard_for_single_variants)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
enum Foo {
|
|
|
|
A,
|
|
|
|
B,
|
|
|
|
C,
|
|
|
|
}
|
|
|
|
|
2020-05-15 16:19:30 -05:00
|
|
|
enum Color {
|
|
|
|
Red,
|
|
|
|
Green,
|
|
|
|
Blue,
|
|
|
|
Rgb(u8, u8, u8),
|
|
|
|
}
|
|
|
|
|
2020-05-09 16:08:41 -05:00
|
|
|
fn main() {
|
2020-05-15 16:19:30 -05:00
|
|
|
let f = Foo::A;
|
|
|
|
match f {
|
2020-05-09 16:08:41 -05:00
|
|
|
Foo::A => {},
|
|
|
|
Foo::B => {},
|
|
|
|
Foo::C => {},
|
|
|
|
}
|
2020-05-15 16:19:30 -05:00
|
|
|
|
|
|
|
let color = Color::Red;
|
|
|
|
|
|
|
|
// check exhaustive bindings
|
|
|
|
match color {
|
|
|
|
Color::Red => {},
|
|
|
|
Color::Green => {},
|
|
|
|
Color::Rgb(_r, _g, _b) => {},
|
|
|
|
Color::Blue => {},
|
|
|
|
}
|
|
|
|
|
|
|
|
// check exhaustive wild
|
|
|
|
match color {
|
|
|
|
Color::Red => {},
|
|
|
|
Color::Green => {},
|
|
|
|
Color::Rgb(..) => {},
|
|
|
|
Color::Blue => {},
|
|
|
|
}
|
|
|
|
match color {
|
|
|
|
Color::Red => {},
|
|
|
|
Color::Green => {},
|
|
|
|
Color::Rgb(_, _, _) => {},
|
|
|
|
Color::Blue => {},
|
|
|
|
}
|
|
|
|
|
|
|
|
// shouldn't lint as there is one missing variant
|
|
|
|
// and one that isn't exhaustively covered
|
|
|
|
match color {
|
|
|
|
Color::Red => {},
|
|
|
|
Color::Green => {},
|
|
|
|
Color::Rgb(255, _, _) => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
2020-05-09 16:08:41 -05:00
|
|
|
}
|