RS.CLIPPY.REST_PAT_IN_FULLY_BOUND_STRUCTS

A match on a struct that binds all fields but still uses the wildcard pattern

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

What it does

Checks for unnecessary '..' pattern binding on struct when all fields are explicitly matched.

Why restrict this?

Correctness and readability. It's like having a wildcard pattern after matching all enum variants explicitly.

Example

let a = A { a: 5 };

match a {
    A { a: 5, .. } => {},
    _ => {},
}

Use instead:

match a {
    A { a: 5 } => {},
    _ => {},
}