RS.CLIPPY.FIELD_REASSIGN_WITH_DEFAULT
Binding initialized with Default should have its fields set in the initializer
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: field_reassign_with_default. Copyright ©2025 The Rust Team. All rights reserved.
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.
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()
};