]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/empty_enum.txt
Rollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett
[rust.git] / src / tools / clippy / src / docs / empty_enum.txt
1 ### What it does
2 Checks for `enum`s with no variants.
3
4 As of this writing, the `never_type` is still a
5 nightly-only experimental API. Therefore, this lint is only triggered
6 if the `never_type` is enabled.
7
8 ### Why is this bad?
9 If you want to introduce a type which
10 can't be instantiated, you should use `!` (the primitive type "never"),
11 or a wrapper around it, because `!` has more extensive
12 compiler support (type inference, etc...) and wrappers
13 around it are the conventional way to define an uninhabited type.
14 For further information visit [never type documentation](https://doc.rust-lang.org/std/primitive.never.html)
15
16
17 ### Example
18 ```
19 enum Test {}
20 ```
21
22 Use instead:
23 ```
24 #![feature(never_type)]
25
26 struct Test(!);
27 ```