]> git.lizzy.rs Git - rust.git/blob - src/docs/exhaustive_enums.txt
Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyup
[rust.git] / src / docs / exhaustive_enums.txt
1 ### What it does
2 Warns on any exported `enum`s that are not tagged `#[non_exhaustive]`
3
4 ### Why is this bad?
5 Exhaustive enums are typically fine, but a project which does
6 not wish to make a stability commitment around exported enums may wish to
7 disable them by default.
8
9 ### Example
10 ```
11 enum Foo {
12     Bar,
13     Baz
14 }
15 ```
16 Use instead:
17 ```
18 #[non_exhaustive]
19 enum Foo {
20     Bar,
21     Baz
22 }
23 ```