Closed
Description
When matching an enum, if there is only one variant left, suggest using that instead of the wildcard pattern.
For example, for this enum:
enum E {
First,
Second,
Third,
}
When matching it like this:
match e {
E::First => {}
E::Second => {}
_ => {}
}
Suggest the following replacement:
match e {
E::First => {}
E::Second => {}
E::Third => {}
}
The lint should be under the pedantic
category.
Note that for #[non_exhaustive]
enums the wildcard arm should be kept.