-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New lint: suggest using the only remaining variant instead of a wildcard #5556
Comments
Hi! I think it is covered by the lint "wildcard enum match arm" implemented in matches.rs
|
Not quite. The But thanks for pointing out, that a lint like this is already implemented. This means, that the only thing that has to be implemented here is |
I want to try to do that, if you don't mind |
That would be great, if you need help with anything don't hesitate to ask here or open a WIP PR. |
I've implemented at least a starting version, but I have some questions.
|
|
When matching an enum, if there is only one variant left, suggest using that instead of the wildcard pattern.
For example, for this enum:
When matching it like this:
Suggest the following replacement:
The lint should be under the
pedantic
category.Note that for
#[non_exhaustive]
enums the wildcard arm should be kept.The text was updated successfully, but these errors were encountered: