rustdoc: synthetic_non_exhaustive
lint
#10550
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
What it does
See discussion in rust-lang/rust#108925 and rust-lang/rust#109007.
enum
's which have a#[doc(hidden)]
attribute are effectively#[non_exhaustive]
. Sometimes a#[doc(hidden)]
__Nonexhaustive
variant (dating from before#[non_exhaustive]
) exists, which . Even in the absence of a explicit variant to artificially synthesize a#[non_exhaustive]
attribute, code which has "hidden" variants should mark itself as non exhaustive to be explicit; they are effectively non-exhaustive.Lint Name
synthetic_non_exhaustive
Category
style
Advantage
Once again, see discussion in linked issues.
enum
s which have#[doc(hidden)]
variants are effectively non-exhaustive and should be marked as such to give clarity to the consumer of theenum
.Drawbacks
See discussion in linked issues (last time I promise).
In summary, we aren't sure about the extent to which this affects existing code and how much of that code is, in actuality, valid. For example,
libcore
andlibbacktrace
are triggered by this lint: inlibbacktrace
at least, the offending code is not idiomatic and is a valid example of this lint.Example
Could be written as:
The text was updated successfully, but these errors were encountered: