diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/init_numbered_fields.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/init_numbered_fields.txt b/src/tools/clippy/src/docs/init_numbered_fields.txt new file mode 100644 index 000000000..ba40af6a5 --- /dev/null +++ b/src/tools/clippy/src/docs/init_numbered_fields.txt @@ -0,0 +1,24 @@ +### What it does +Checks for tuple structs initialized with field syntax. +It will however not lint if a base initializer is present. +The lint will also ignore code in macros. + +### Why is this bad? +This may be confusing to the uninitiated and adds no +benefit as opposed to tuple initializers + +### Example +``` +struct TupleStruct(u8, u16); + +let _ = TupleStruct { + 0: 1, + 1: 23, +}; + +// should be written as +let base = TupleStruct(1, 23); + +// This is OK however +let _ = TupleStruct { 0: 42, ..base }; +```
\ No newline at end of file |