Unit-like structs should not trigger exhaustive_structs
#12675
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
By using unit-like struct syntax, one is opting into behavior which is incompatible with ever adding any fields (the constant named after the struct). Therefore, adding
#[non_exhaustive]
does not provide any forward-compatibility benefit — adding fields is always a breaking change. Therefore, Clippy should not recommend#[non_exhaustive]
on unit-like structs.Lint Name
exhaustive_structs
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen: No lint
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: