RS.CLIPPY.NEEDLESS_UPDATE

Using `Foo { ..base }` when there are no missing fields

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: needless_update. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for needlessly including a base struct on update when all fields are changed anyway.

This lint is not applied to structs marked with non_exhaustive.

Why is this bad?

This will cost resources (because the base has to be somewhere), and make the code less readable.

Example

Point {
    x: 1,
    y: 1,
    z: 1,
    ..zero_point
};

Use instead:

// Missing field `z`
Point {
    x: 1,
    y: 1,
    ..zero_point
};