Skip to content

Allow a rest pattern before closing brace when destructuring #4893

Open
@Kolsky

Description

@Kolsky

Example for a struct:

let Self {
    x,
    y,
.. } = self;

match x {
    Variant::A {
        a,
        b,
    .. } => { /* snip */ }
    _ => todo!(),
}

Currently a .. is placed either on a separate line, or, in case of match and/or a short list of required fields, right after the trailing comma, all on the same line. I also think the above style may serve the best for the same purpose that a trailing commas are intended for. Please consider, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    community drivenIssues the rustfmt team will not work on directly. Intended for contributors!feature-requestp-low

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions