Skip to content

Allow a rest pattern before closing brace when destructuring #4893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Kolsky opened this issue Jul 8, 2021 · 1 comment
Open

Allow a rest pattern before closing brace when destructuring #4893

Kolsky opened this issue Jul 8, 2021 · 1 comment
Labels
community driven Issues the rustfmt team will not work on directly. Intended for contributors! feature-request p-low

Comments

@Kolsky
Copy link

Kolsky commented Jul 8, 2021

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.

@calebcartwright
Copy link
Member

Thank you for reaching out. I will leave this open for a bit on the off chance that someone strongly interested in this style is willing to submit an implementation for consideration, but it's highly unlikely that the rustfmt team will ever implement ourselves.

rustfmt's core purpose is to reformat code according to the Rust Style Guide and rustfmt's default formatting must always adhere to that spec. Configuration options are supported in rustfmt primarily to address some of the areas where there's large pockets of disagreement (e.g. tabs vs. spaces). We're generally open to considering new options beyond those, but we have to then evaluate the associated burden on the codebase, maintenance, bug surface, etc. and whether the corresponding style is something desired by a sizeable portion of our user base or a more personal esoteric style.

@ytmimi ytmimi added feature-request community driven Issues the rustfmt team will not work on directly. Intended for contributors! labels Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community driven Issues the rustfmt team will not work on directly. Intended for contributors! feature-request p-low
Projects
None yet
Development

No branches or pull requests

3 participants