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
Don't lint manual_non_exhaustive
when enum is #[non_exhaustive]
#11590
Conversation
…n_exhaustive` There are cases where users create a unit variant for the purposes of tracking the number of variants for an nonexhaustive enum. We should check if an enum is explicitly marked as nonexhaustive before reporting `manual_non_exhaustive` in these cases. Fixes rust-lang#11583
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Alexendoo (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Thanks! Could you also remove the now unneeded check on line 203 |
I've removed the unneeded check, but having seen this I'm a little confused as to why this check didn't catch this false positive. Do you mind explaining? |
IIRC this was linting on purpose here to catch when the attribute was added, but the extra variant wasn't removed. Probably should have been it's own lint rather than reusing |
Yeah, the check only omitted part of the suggestion rather than the whole lint Thanks! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #11583
changelog: Fix [
manual_non_exhaustive
] false positive for unit enum variants when enum is explicitlynon_exhaustive
.