-
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
Implement the manual_non_exhaustive lint #5550
Conversation
1b49ae7
to
f072ded
Compare
I've realized that we should keep linting if the attribute was added but the private field/marker variant was not removed. I'll add a follow-up commit tonight. Also, the RFC proposes a clippy lint to check when matching non-exhaustive enums that all patterns are covered, to help downstream crates notice that new variants were added. Would it make sense to add it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've realized that we should keep linting if the attribute was added but the private field/marker variant was not removed.
I should have read your comment before reviewing. Just removed my comment about this 😄
Would it make sense to add it?
This would be a good allow-by-default lint. So I would separate it from this lint and add it as a pedantic lint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small thing left.
Co-authored-by: Philipp Krones <hello@philkrones.com>
240065b
to
350c17d
Compare
@bors r+ |
📌 Commit 350c17d has been approved by |
Implement the manual_non_exhaustive lint Some implementation notes: * Not providing automatic fixups because additional changes may be needed in other parts of the code, e.g. when constructing a struct. * Even though the attribute is valid on enum variants, it's not possible to use the manual implementation of the pattern because the visibility is always public, so the lint ignores enum variants. * Unit structs are also ignored, it's not possible to implement the pattern manually without fields. * The attribute is not accepted in unions, so those are ignored too. * Even though the original issue did not mention it, tuple structs are also linted because it's possible to apply the pattern manually. changelog: Added the manual non-exhaustive implementation lint Closes #2017
💥 Test timed out |
@bors retry |
💔 Test failed - checks-action_test |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Some implementation notes:
changelog: Added the manual non-exhaustive implementation lint
Closes #2017