RS.CLIPPY.EXHAUSTIVE_STRUCTS
Detects exported structs 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_structs. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Warns on any exported structs that are not tagged #[non_exhaustive]
Why restrict this?
Making a struct exhaustive is a stability commitment: adding a field is a breaking change.
A project may wish to ensure that there are no exhaustive structs or that every exhaustive
struct is explicitly #[allow]ed.
Example
struct Foo {
bar: u8,
baz: String,
}
Use instead:
#[non_exhaustive]
struct Foo {
bar: u8,
baz: String,
}