summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/init_numbered_fields.txt
blob: ba40af6a5fa555df8eb9843ed1bc9202711ad1e0 (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
### 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 };
```