RS.CLIPPY.REDUNDANT_AT_REST_PATTERN

Checks for `[all @ ..]` where `all` would suffice

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

What it does

Checks for [all @ ..] patterns.

Why is this bad?

In all cases, all works fine and can often make code simpler, as you possibly won't need to convert from say a Vec to a slice by dereferencing.

Example

if let [all @ ..] = &*v {
    // NOTE: Type is a slice here
    println!("all elements: {all:#?}");
}

Use instead:

if let all = v {
    // NOTE: Type is a `Vec` here
    println!("all elements: {all:#?}");
}
// or
println!("all elements: {v:#?}");