diff options
Diffstat (limited to 'src/tools/clippy/src/docs/needless_update.txt')
-rw-r--r-- | src/tools/clippy/src/docs/needless_update.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/needless_update.txt b/src/tools/clippy/src/docs/needless_update.txt new file mode 100644 index 000000000..82adabf64 --- /dev/null +++ b/src/tools/clippy/src/docs/needless_update.txt @@ -0,0 +1,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 +}; +```
\ No newline at end of file |