Skip to content

Clarify style of empty match arms #146

@varkor

Description

@varkor

There are two styles of empty match arms prevalent in Rust code:

match x {
	a => {} // Option A
	b => () // Option B
}

The preferred option should be specified by the style guide (and correspondingly enforced by rustfmt). For reference, rustc currently uses a mixture, but with a bias towards Option A.

https://github.com/rust-dev-tools/fmt-rfcs/blob/master/guide/expressions.md#match doesn't mention this issue, though one of the examples does show an arm using Option A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions