Skip to content

Update non_exhaustive to use the attribute template #1921

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Jun 30, 2025

New rules:

  • attributes.type-system.non_exhaustive.duplicates
  • attributes.type-system.non_exhaustive.enum-exhaustiveness
  • attributes.type-system.non_exhaustive.enum-cast
  • attributes.type-system.non_exhaustive.inhabited

Renamed rules:

  • attributes.type-system.non_exhaustive.external-crate moved to .intro because it is generally explaining the purpose.

ehuss added 16 commits June 27, 2025 14:47
This adds a rule name that was missing for this statement. It also
clarifies why this is being said.
This statement isn't really a rule, but more of a high-level
explanation. I have moved it to the intro where I think it better
belongs.
Some word cleanup and a hidden clarification.
The original felt a little awkward with how it differentiated between
enum and enum variants. I also wasn't terribly happy with using a list
here.
This adds a missing rule for this paragraph. It also adds a little more
clarity as to what it means.
The existing rule was mixing pattern match restrictions with match arm
exhaustiveness. Although very closely related, I think they deserve to
be split up.

This also adds a little clarity about tuple matching.
`type` is a keyword and can't be used here.
Single-segment identifiers are bindings and don't work to match
against a Unit struct.
The intent here is to highlight exactly where the errors are in the
example (and which ones aren't errors!).
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: The marked PR is awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants