-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New lint: manual_exhaustive_pattern (#14518) #14632
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
base: master
Are you sure you want to change the base?
New lint: manual_exhaustive_pattern (#14518) #14632
Conversation
rustbot has assigned @samueltardieu. Use |
04f0516
to
f6b3f1d
Compare
f6b3f1d
to
eea351f
Compare
Okay I think ive got it mostly working now, the issue is my new lint interferes with test cases in single_match and I dont know how to tell the system that both warning should so? |
Also |
|
What would be the reason to restrict this lint to For example, there is no reason why |
With regards to the other enums. in the |
All enums not marked
The |
I'll look into the match_arm stuff later. The use on applying to any enums conflicts with wildcard_enum_match_arm. |
You should find all the information you need from the types section of the Rust compiler development guide. Let us know if something is missing from there. Also, many Clippy lints deal with variants, and you should be able to take inspiration from them. |
Rerolling as I'll be AFK for a while. |
I'll take a look at the docs for getting other enums, however I mantain that applying this lint to none built-in/standard libarary enums conflicts with wildcard_enum_match_arm. |
Nominating this since linting in the area (exhaustive matching) has a bigger design space than we've worked on and would benefit from designing the lint set as a whole rather than just adding more small lints. This is not to say that linting this particular case is a bad idea, just that I believe there are better ways to accomplish this goal. One thing we could do is have a config for enums which should be explicitly matched and for enums which should not be. There are cases like |
I think I've done most of what needs to be done, need help writing tests
Please write a short comment explaining your change (or "none" for internal only changes)
Adding a new lint that captrures unessary exhaustive patterns for booleans and the built in enums Result and Option
changelog: [
manual_exhaustive_pattern
]: new lint added