summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/enum_variant_names.txt
blob: e726925edda82ca777546cf7e613ee78304c10a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
### What it does
Detects enumeration variants that are prefixed or suffixed
by the same characters.

### Why is this bad?
Enumeration variant names should specify their variant,
not repeat the enumeration name.

### Limitations
Characters with no casing will be considered when comparing prefixes/suffixes
This applies to numbers and non-ascii characters without casing
e.g. `Foo1` and `Foo2` is considered to have different prefixes
(the prefixes are `Foo1` and `Foo2` respectively), as also `Bar螃`, `Bar蟹`

### Example
```
enum Cake {
    BlackForestCake,
    HummingbirdCake,
    BattenbergCake,
}
```
Use instead:
```
enum Cake {
    BlackForest,
    Hummingbird,
    Battenberg,
}
```