Skip to content

Allow not indenting match arms #2937

Open
@strega-nil

Description

@strega-nil

It's a common style in C++ to see:

switch (foo) {
case Foo::Bar: {
  ...
} break;
case Foo::Baz: {
  ...
} break;
}

I would like a similar style to be possible with rustfmt:

match foo {
| Foo::Bar => {
    ...
}
| Foo::Baz => {
    ...
}
}

or

match foo {
Foo::Bar => {
    ...
}
Foo::Baz => {
    ...
}
}

This would require two configuration options, probably; | before each case, and the non-indentation.

Thanks!

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