]> git.lizzy.rs Git - rust.git/blob - src/docs/needless_update.txt
Add iter_kv_map lint
[rust.git] / src / docs / needless_update.txt
1 ### What it does
2 Checks for needlessly including a base struct on update
3 when all fields are changed anyway.
4
5 This lint is not applied to structs marked with
6 [non_exhaustive](https://doc.rust-lang.org/reference/attributes/type_system.html).
7
8 ### Why is this bad?
9 This will cost resources (because the base has to be
10 somewhere), and make the code less readable.
11
12 ### Example
13 ```
14 Point {
15     x: 1,
16     y: 1,
17     z: 1,
18     ..zero_point
19 };
20 ```
21
22 Use instead:
23 ```
24 // Missing field `z`
25 Point {
26     x: 1,
27     y: 1,
28     ..zero_point
29 };
30 ```