blob: e58b7239fde9e039676d3208a95a8ebbcf991cce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
### What it does
Checks for immediate reassignment of fields initialized
with Default::default().
### Why is this bad?
It's more idiomatic to use the [functional update syntax](https://doc.rust-lang.org/reference/expressions/struct-expr.html#functional-update-syntax).
### Known problems
Assignments to patterns that are of tuple type are not linted.
### Example
```
let mut a: A = Default::default();
a.i = 42;
```
Use instead:
```
let a = A {
i: 42,
.. Default::default()
};
```
|