blob: 9e197c786201d23538234caccc473070e3fe8275 (
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
|
### What it does
Checks for excessive
use of bools in structs.
### Why is this bad?
Excessive bools in a struct
is often a sign that it's used as a state machine,
which is much better implemented as an enum.
If it's not the case, excessive bools usually benefit
from refactoring into two-variant enums for better
readability and API.
### Example
```
struct S {
is_pending: bool,
is_processing: bool,
is_finished: bool,
}
```
Use instead:
```
enum S {
Pending,
Processing,
Finished,
}
```
|