Clarify style of empty match arms
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.
I've never seen option B before, and I wouldn't consider it a formatting option so much as a special case of "you can omit the braces" with a unit value.
Nonetheless, if you feel that this should be documented in the style guide, we could add an explicit note that "An empty match arm should be written as pattern => {}."
Option B is also relatively common. I'll make a pull request.
Option A is implemented in rustfmt https://github.com/rust-lang/rustfmt/pull/4226 see https://github.com/rust-lang/rustfmt/issues/4065 for the tracking issue.
Just to add some rationale, I like {} because to me it reads "do nothing" and () reads "a unit". I would rather not think about a unit. Similar to not writing a return type -> ().