diff options
Diffstat (limited to 'src/tools/clippy/src/docs/redundant_field_names.txt')
-rw-r--r-- | src/tools/clippy/src/docs/redundant_field_names.txt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/redundant_field_names.txt b/src/tools/clippy/src/docs/redundant_field_names.txt new file mode 100644 index 000000000..35f20a466 --- /dev/null +++ b/src/tools/clippy/src/docs/redundant_field_names.txt @@ -0,0 +1,22 @@ +### What it does +Checks for fields in struct literals where shorthands +could be used. + +### Why is this bad? +If the field and variable names are the same, +the field name is redundant. + +### Example +``` +let bar: u8 = 123; + +struct Foo { + bar: u8, +} + +let foo = Foo { bar: bar }; +``` +the last line can be simplified to +``` +let foo = Foo { bar }; +```
\ No newline at end of file |