]> git.lizzy.rs Git - rust.git/blob - src/docs/enum_variant_names.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / enum_variant_names.txt
1 ### What it does
2 Detects enumeration variants that are prefixed or suffixed
3 by the same characters.
4
5 ### Why is this bad?
6 Enumeration variant names should specify their variant,
7 not repeat the enumeration name.
8
9 ### Limitations
10 Characters with no casing will be considered when comparing prefixes/suffixes
11 This applies to numbers and non-ascii characters without casing
12 e.g. `Foo1` and `Foo2` is considered to have different prefixes
13 (the prefixes are `Foo1` and `Foo2` respectively), as also `Bar螃`, `Bar蟹`
14
15 ### Example
16 ```
17 enum Cake {
18     BlackForestCake,
19     HummingbirdCake,
20     BattenbergCake,
21 }
22 ```
23 Use instead:
24 ```
25 enum Cake {
26     BlackForest,
27     Hummingbird,
28     Battenberg,
29 }
30 ```