summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/needless_update.txt
blob: 82adabf6482c3daf902ce0aa38b3f11c1b49d1c4 (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
Checks for needlessly including a base struct on update
when all fields are changed anyway.

This lint is not applied to structs marked with
[non_exhaustive](https://doc.rust-lang.org/reference/attributes/type_system.html).

### Why is this bad?
This will cost resources (because the base has to be
somewhere), and make the code less readable.

### Example
```
Point {
    x: 1,
    y: 1,
    z: 1,
    ..zero_point
};
```

Use instead:
```
// Missing field `z`
Point {
    x: 1,
    y: 1,
    ..zero_point
};
```