]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/exhaustive_enums.txt
Rollup merge of #101606 - akhi3030:patch-1, r=Dylan-DPC
[rust.git] / src / tools / clippy / 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 ```