RS.CLIPPY.UNNEEDED_FIELD_PATTERN

Struct fields bound to a wildcard instead of using `..`

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

What it does

Checks for structure field patterns bound to wildcards.

Why restrict this?

Using .. instead is shorter and leaves the focus on the fields that are actually bound.

Example

let f = Foo { a: 0, b: 0, c: 0 };

match f {
    Foo { a: _, b: 0, .. } => {},
    Foo { a: _, b: _, c: _ } => {},
}

Use instead:

let f = Foo { a: 0, b: 0, c: 0 };

match f {
    Foo { b: 0, .. } => {},
    Foo { .. } => {},
}