Skip to content

Formatting does not work with match arm having mixed OR clauses and comments #6491

Open
@snprajwal

Description

@snprajwal

Related to #6060 and #6044. For the below snippet, rustfmt does nothing at all:

enum Foo {
    A,
    B,
    C,
    D,
}

fn main() {
    let foo = Foo::A;
    match foo {
        // Here is a comment
Foo::A |
    // And another one
        Foo::B |
        // Hey look! There's another one
    Foo::C |
// That's a lot of comments
        Foo::D => {}
    }
}

If someone more knowledgeable about rustfmt internals can please confirm that this is a solvable bug, I'd be happy to contribute the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions