-
Notifications
You must be signed in to change notification settings - Fork 56
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
Clarify style of empty match arms #146
Comments
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 |
Option B is also relatively common. I'll make a pull request. |
Option A is implemented in rustfmt rust-lang/rustfmt#4226 see rust-lang/rustfmt#4065 for the tracking issue. |
Just to add some rationale, I like |
There are two styles of empty match arms prevalent in Rust code:
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.
The text was updated successfully, but these errors were encountered: