Skip to content
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

Poor formatting of slice_patterns #2909

Closed
dtolnay opened this issue Aug 10, 2018 · 1 comment
Closed

Poor formatting of slice_patterns #2909

dtolnay opened this issue Aug 10, 2018 · 1 comment
Labels
bug Panic, non-idempotency, invalid code, etc. poor-formatting

Comments

@dtolnay
Copy link
Member

dtolnay commented Aug 10, 2018

#![feature(slice_patterns)]

fn main() {
    match b"123" {
        [0, ..] => {}
        _ => {}
    }
}

As of rustfmt 0.99.1-nightly (da17b68 2018-08-04), formatting produces the following diff which I believe is less readable than the original:

-         [0, ..] => {}
+         [0, _..] => {}
@faern
Copy link

faern commented Aug 12, 2018

Why is _.. even accepted syntax? It is not allowed in normal pattern matching:

let (a, _..) = (1, 2 ,3);

does not even compile.

@nrc nrc added the bug Panic, non-idempotency, invalid code, etc. label Aug 13, 2018
@nrc nrc closed this as completed in #2912 Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. poor-formatting
Projects
None yet
Development

No branches or pull requests

4 participants