}
```
-See also: [`trailing_comma`](#trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
+See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
## `max_width`
// commodo consequat.
```
-## `wrap_match_arms`
+## `match_arm_blocks`
Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
reorder_imported_names: bool, true, false,
"Reorder lists of names in import statements alphabetically";
- // Match
- wrap_match_arms: bool, true, false, "Wrap the body of arms in blocks when it does not fit on \
- the same line with the pattern of arms";
- match_block_trailing_comma: bool, false, false,
- "Put a trailing comma after a block based match arm (non-block arms are not affected)";
-
// Spaces around punctuation
binop_separator: SeparatorPlace, SeparatorPlace::Front, false,
"Where to put a binary operator when a binary expression goes multiline.";
"Remove blank lines at start or end of a block";
same_line_attributes: bool, true, false,
"Try to put attributes on the same line as fields and variants.";
+ match_arm_blocks: bool, true, false, "Wrap the body of arms in blocks when it does not fit on \
+ the same line with the pattern of arms";
force_multiline_blocks: bool, false, false,
"Force multiline closure bodies and match arms to be wrapped in a block";
fn_args_density: Density, Density::Tall, false, "Argument density in functions";
"How to handle trailing commas for lists";
trailing_semicolon: bool, true, false,
"Add trailing semicolon after break, continue and return";
+ match_block_trailing_comma: bool, false, false,
+ "Put a trailing comma after a block based match arm (non-block arms are not affected)";
// Options that can change the source code beyond whitespace/blocks (somewhat linty things)
merge_derives: bool, true, true, "Merge multiple `#[derive(...)]` into a single one";
let indent_str = shape.indent.to_string(context.config);
let nested_indent_str = next_line_indent.to_string(context.config);
- let (body_prefix, body_suffix) = if context.config.wrap_match_arms() {
+ let (body_prefix, body_suffix) = if context.config.match_arm_blocks() {
let comma = if context.config.match_block_trailing_comma() {
","
} else {
--- /dev/null
+// rustfmt-match_arm_blocks: false
+// Wrap match-arms
+
+fn main() {
+ match lorem {
+ true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
+ false => {
+ println!("{}", sit)
+ }
+ }
+}
--- /dev/null
+// rustfmt-match_arm_blocks: true
+// Wrap match-arms
+
+fn main() {
+ match lorem {
+ true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
+ false => {
+ println!("{}", sit)
+ }
+ }
+}
+++ /dev/null
-// rustfmt-wrap_match_arms: false
-// Wrap match-arms
-
-fn main() {
- match lorem {
- true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
- false => {
- println!("{}", sit)
- }
- }
-}
+++ /dev/null
-// rustfmt-wrap_match_arms: true
-// Wrap match-arms
-
-fn main() {
- match lorem {
- true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
- false => {
- println!("{}", sit)
- }
- }
-}
// rustfmt-max_width:120
-// rustfmt-wrap_match_arms: false
+// rustfmt-match_arm_blocks: false
// rustfmt-match_block_trailing_comma: true
fn a_very_very_very_very_very_very_very_very_very_very_very_long_function_name() -> i32 {
-// rustfmt-wrap_match_arms: false
+// rustfmt-match_arm_blocks: false
// rustfmt-match_block_trailing_comma: true
// Match expressions, no unwrapping of block arms or wrapping of multiline
// expressions.
-// rustfmt-wrap_match_arms: false
+// rustfmt-match_arm_blocks: false
// Match expressions, no unwrapping of block arms or wrapping of multiline
// expressions.
match rewrite {
Some(ref body_str)
if (!body_str.contains('\n') && body_str.len() <= arm_shape.width)
- || !context.config.wrap_match_arms()
+ || !context.config.match_arm_blocks()
|| (extend && first_line_width(body_str) <= arm_shape.width)
|| is_block =>
{
--- /dev/null
+// rustfmt-match_arm_blocks: false
+// Wrap match-arms
+
+fn main() {
+ match lorem {
+ true =>
+ foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
+ false => println!("{}", sit),
+ }
+}
--- /dev/null
+// rustfmt-match_arm_blocks: true
+// Wrap match-arms
+
+fn main() {
+ match lorem {
+ true => {
+ foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
+ }
+ false => println!("{}", sit),
+ }
+}
+++ /dev/null
-// rustfmt-wrap_match_arms: false
-// Wrap match-arms
-
-fn main() {
- match lorem {
- true =>
- foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
- false => println!("{}", sit),
- }
-}
+++ /dev/null
-// rustfmt-wrap_match_arms: true
-// Wrap match-arms
-
-fn main() {
- match lorem {
- true => {
- foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
- }
- false => println!("{}", sit),
- }
-}
// rustfmt-max_width:120
-// rustfmt-wrap_match_arms: false
+// rustfmt-match_arm_blocks: false
// rustfmt-match_block_trailing_comma: true
fn a_very_very_very_very_very_very_very_very_very_very_very_long_function_name() -> i32 {
-// rustfmt-wrap_match_arms: false
+// rustfmt-match_arm_blocks: false
// rustfmt-match_block_trailing_comma: true
// Match expressions, no unwrapping of block arms or wrapping of multiline
// expressions.
-// rustfmt-wrap_match_arms: false
+// rustfmt-match_arm_blocks: false
// Match expressions, no unwrapping of block arms or wrapping of multiline
// expressions.