blob: a22d2994602ac67fcd2c8c050088906baf0ff64d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
### What it does
Detects `().hash(_)`.
### Why is this bad?
Hashing a unit value doesn't do anything as the implementation of `Hash` for `()` is a no-op.
### Example
```
match my_enum {
Empty => ().hash(&mut state),
WithValue(x) => x.hash(&mut state),
}
```
Use instead:
```
match my_enum {
Empty => 0_u8.hash(&mut state),
WithValue(x) => x.hash(&mut state),
}
```
|