RS.CLIPPY.EXHAUSTIVE_ENUMS

Detects exported enums that have not been marked #[non_exhaustive]

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: exhaustive_enums. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Warns on any exported enums that are not tagged #[non_exhaustive]

Why restrict this?

Making an enum exhaustive is a stability commitment: adding a variant is a breaking change. A project may wish to ensure that there are no exhaustive enums or that every exhaustive enum is explicitly #[allow]ed.

Example

enum Foo {
    Bar,
    Baz
}

Use instead:

#[non_exhaustive]
enum Foo {
    Bar,
    Baz
}