```toml
indent_style = "Block"
-array_width = 80
reorder_imported_names = true
```
+Each configuration option is either stable or unstable.
+Stable options can be used directly, while unstable options are opt-in.
+To enable unstable options, set `unstable_features = true` in `rustfmt.toml` or pass `--unstable-options` to rustfmt.
+
# Configuration Options
Below you find a detailed visual guide on all the supported configuration options of rustfmt:
-## `array_horizontal_layout_threshold`
-
-How many elements array must have before rustfmt uses horizontal layout.
-Use this option to prevent a huge array from being vertically formatted.
-
-- **Default value**: `0`
-- **Possible values**: any positive integer
-
-**Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width.
-
-#### `0` (default):
-
-```rust
-// Each element will be placed on its own line.
-let a = vec![
- 0,
- 1,
- 2,
- 3,
- 4,
- ...
- 999,
- 1000,
-];
-```
-
-#### `1000`:
-
-```rust
-// Each element will be placed on the same line as much as possible.
-let a = vec![
- 0, 1, 2, 3, 4, ...
- ..., 999, 1000,
-];
-```
## `indent_style`
- **Default value**: `"Block"`
- **Possible values**: `"Block"`, `"Visual"`
+- **Stable**: No
### Array
```rust
fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
-where
+where
Ipsum: Eq,
Dolor: Eq,
Sit: Eq,
}
```
-See also: [`where_density`](#where_density), [`where_layout`](#where_layout).
-
-## `array_width`
-
-Maximum width of an array literal before falling back to vertical formatting
-
-- **Default value**: `60`
-- **Possible values**: any positive integer
-
-**Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width.
-
-#### Lines shorter than `array_width`:
-```rust
-let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"];
-```
-
-#### Lines longer than `array_width`:
-See [`indent_style`](#indent_style).
## `same_line_attributes`
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `true` (default):
}
```
+## `use_small_heuristics`
+
+Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'.
+
+- **Default value**: `true`
+- **Possible values**: `true`, `false`
+- **Stable**: No
+
+#### `true` (default):
+
+```rust
+enum Lorem {
+ Ipsum,
+ Dolor(bool),
+ Sit { amet: Consectetur, adipiscing: Elit },
+}
+
+fn main() {
+ lorem(
+ "lorem",
+ "ipsum",
+ "dolor",
+ "sit",
+ "amet",
+ "consectetur",
+ "adipiscing",
+ );
+
+ let lorem = Lorem { ipsum: dolor, sit: amet };
+
+ let lorem = if ipsum { dolor } else { sit };
+}
+```
+
+#### `false`:
+
+```rust
+enum Lorem {
+ Ipsum,
+ Dolor(bool),
+ Sit {
+ amet: Consectetur,
+ adipiscing: Elit,
+ },
+}
+
+fn main() {
+ lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");
+
+ let lorem = Lorem {
+ ipsum: dolor,
+ sit: amet,
+ };
+
+ let lorem = if ipsum {
+ dolor
+ } else {
+ sit
+ };
+}
+```
## `binop_separator`
- **Default value**: `"Front"`
- **Possible values**: `"Front"`, `"Back"`
+- **Stable**: No
#### `"Front"` (default):
bbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
```
-## `chain_indent`
-
-Indentation of chain
-
-- **Default value**: `"Block"`
-- **Possible values**: `"Block"`, `"Visual"`
-
-#### `"Block"` (default):
-
-```rust
-let lorem = ipsum
- .dolor()
- .sit()
- .amet()
- .consectetur()
- .adipiscing()
- .elit();
-```
-
-#### `"Visual"`:
-
-```rust
-let lorem = ipsum.dolor()
- .sit()
- .amet()
- .consectetur()
- .adipiscing()
- .elit();
-```
-
-See also [`chain_width`](#chain_width).
-
-## `chain_width`
-
-Maximum length of a chain to fit on a single line
-
-- **Default value**: `60`
-- **Possible values**: any positive integer
-
-#### Lines shorter than `chain_width`:
-```rust
-let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
-```
-
-#### Lines longer than `chain_width`:
-See [`chain_indent`](#chain_indent).
-
-
## `combine_control_expr`
Combine control expressions with function calls.
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `true` (default):
- **Default value**: `80`
- **Possible values**: any positive integer
+- **Stable**: No
**Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
- **Default value**: `"AlwaysSameLine"`
- **Possible values**: `"AlwaysNextLine"`, `"AlwaysSameLine"`, `"ClosingNextLine"`
+- **Stable**: No
#### `"AlwaysSameLine"` (default):
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
## `error_on_line_overflow`
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
See also [`max_width`](#max_width).
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
See also [`comment_width`](#comment_width).
Argument density in functions
- **Default value**: `"Tall"`
-- **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
+- **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
+- **Stable**: No
#### `"Tall"` (default):
}
```
-#### `"CompressedIfEmpty"`:
-
-```rust
-trait Lorem {
- fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
-
- fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
- // body
- }
-
- fn lorem(
- ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
- adipiscing: Adipiscing, elit: Elit,
- );
-
- fn lorem(
- ipsum: Ipsum,
- dolor: Dolor,
- sit: Sit,
- amet: Amet,
- consectetur: Consectetur,
- adipiscing: Adipiscing,
- elit: Elit,
- ) {
- // body
- }
-}
-```
-
#### `"Vertical"`:
```rust
- **Default value**: `"SameLineWhere"`
- **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
+- **Stable**: No
### Functions
}
```
-## `fn_call_width`
-Maximum width of the args of a function call before falling back to vertical formatting
+## `empty_item_single_line`
-- **Default value**: `60`
-- **Possible values**: any positive integer
-
-**Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
-
-#### Function call shorter than `fn_call_width`:
-```rust
-lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
-```
-
-#### Function call longer than `fn_call_width`:
-
-See [`indent_style`](#indent_style).
-
-## `fn_empty_single_line`
-
-Put empty-body functions on a single line
+Put empty-body functions and impls on a single line
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `true` (default):
```rust
fn lorem() {}
+
+impl Lorem {}
```
#### `false`:
```rust
fn lorem() {
}
+
+impl Lorem {
+}
```
-See also [`control_brace_style`](#control_brace_style).
+See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
## `fn_single_line`
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
See also [`control_brace_style`](#control_brace_style).
+
+## `where_single_line`
+
+To force single line where layout
+
+- **Default value**: `false`
+- **Possible values**: `true`, `false`
+- **Stable**: No
+
+#### `false` (default):
+
+```rust
+impl<T> Lorem for T
+where
+ Option<T>: Ipsum,
+{
+ ...
+}
+```
+
+#### `true`:
+
+```rust
+impl<T> Lorem for T
+where Option<T>: Ipsum {
+ ...
+}
+```
+
+See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
+
+
## `force_explicit_abi`
Always print the abi for extern items
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: Yes
**Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: Yes
#### `false` (default):
See also: [`tab_spaces`](#tab_spaces).
-## `impl_empty_single_line`
-
-Put empty-body implementations on a single line
-
-- **Default value**: `true`
-- **Possible values**: `true`, `false`
-
-#### `true` (default):
-
-```rust
-impl Lorem {}
-```
-
-#### `false`:
-
-```rust
-impl Lorem {
-}
-```
-
-See also [`brace_style`](#brace_style).
-
-## `indent_match_arms`
-
-Indent match arms instead of keeping them at the same indentation level as the match keyword
-
-- **Default value**: `true`
-- **Possible values**: `true`, `false`
-
-#### `true` (default):
-
-```rust
-match lorem {
- Lorem::Ipsum => (),
- Lorem::Dolor => (),
- Lorem::Sit => (),
- Lorem::Amet => (),
-}
-```
-
-#### `false`:
-
-```rust
-match lorem {
-Lorem::Ipsum => (),
-Lorem::Dolor => (),
-Lorem::Sit => (),
-Lorem::Amet => (),
-}
-```
-
-See also: [`match_block_trailing_comma`](#match_block_trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
## `imports_indent`
- **Default Value**: `"Visual"`
- **Possible values**: `"Block"`, `"Visual"`
+- **Stable**: No
#### `"Visual"` (default):
- **Default value**: "Mixed"
- **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
+- **Stable**: No
#### `"Mixed"` (default):
fff};
```
-## `match_arm_forces_newline`
-
-Consistently put match arms (block based or not) in a newline.
-
-- **Default value**: `false`
-- **Possible values**: `true`, `false`
-
-#### `false` (default):
-
-```rust
-match x {
- // a non-empty block
- X0 => {
- f();
- }
- // an empty block
- X1 => {}
- // a non-block
- X2 => println!("ok"),
-}
-```
-
-#### `true`:
-
-```rust
-match x {
- // a non-empty block
- X0 => {
- f();
- }
- // an empty block
- X1 =>
- {}
- // a non-block
- X2 => {
- println!("ok")
- }
-}
-```
-
-See also: [`wrap_match_arms`](#wrap_match_arms).
## `match_block_trailing_comma`
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
}
```
-See also: [`indent_match_arms`](#indent_match_arms), [`trailing_comma`](#trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
+See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
## `max_width`
- **Default value**: `100`
- **Possible values**: any positive integer
+- **Stable**: Yes
See also [`error_on_line_overflow`](#error_on_line_overflow).
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: Yes
#### `true` (default):
pub enum Foo {}
```
-## `multiline_closure_forces_block`
+## `force_multiline_blocks`
-Force multiline closure bodies to be wrapped in a block
+Force multiline closure and match arm bodies to be wrapped in a block
- **Default value**: `false`
- **Possible values**: `false`, `true`
+- **Stable**: No
#### `false` (default):
None => ...,
Some(value) => ...,
})
+
+match lorem {
+ None => if ipsum {
+ println!("Hello World");
+ },
+ Some(dolor) => ...,
+}
```
#### `true`:
Some(value) => ...,
}
})
-```
-
-## `multiline_match_arm_forces_block`
-
-Force multiline match arm bodies to be wrapped in a block
-
-- **Default value**: `false`
-- **Possible values**: `false`, `true`
-
-#### `false` (default):
-
-```rust
-match lorem {
- None => if ipsum {
- println!("Hello World");
- },
- Some(dolor) => ...,
-}
-```
-#### `true`:
-
-```rust
match lorem {
None => {
if ipsum {
}
```
+
## `newline_style`
Unix or Windows line endings
- **Default value**: `"Unix"`
- **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
+- **Stable**: Yes
## `normalize_comments`
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: Yes
#### `false` (default):
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
**Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `true` (default):
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
**Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
- **Default value**: `"Never"`
- **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
+- **Stable**: No
Warns about any comments containing `TODO` in them when set to `"Always"`. If
it contains a `#X` (with `X` being a number) in parentheses following the
- **Default value**: `"Never"`
- **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
+- **Stable**: No
Warns about any comments containing `FIXME` in them when set to `"Always"`. If
it contains a `#X` (with `X` being a number) in parentheses following the
See also [`report_todo`](#report_todo).
-## `single_line_if_else_max_width`
-
-Maximum line length for single line if-else expressions.
-
-- **Default value**: `50`
-- **Possible values**: any positive integer
-
-**Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
-
-#### Lines shorter than `single_line_if_else_max_width`:
-```rust
-let lorem = if ipsum { dolor } else { sit };
-```
-
-#### Lines longer than `single_line_if_else_max_width`:
-```rust
-let lorem = if ipsum {
- dolor
-} else {
- sit
-};
-```
-
-See also: [`control_brace_style`](#control_brace_style).
## `skip_children`
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
## `space_after_colon`
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `true` (default):
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
- **Default value** : 0
- **Possible values**: any positive integer
+- **Stable**: No
#### `0` (default):
}
```
-```
-
## `spaces_around_ranges`
Put spaces around the .. and ... range operators
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
## `spaces_within_parens_and_brackets`
-Put spaces within non-empty generic arguments
+Put spaces within non-empty generic arguments, parentheses, and square brackets
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
```rust
+// generic arguments
fn lorem<T: Eq>(t: T) {
// body
}
-```
-
-#### `true`:
-```rust
-fn lorem< T: Eq >(t: T) {
- // body
-}
-```
-
-See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
-
-## `spaces_within_parens_and_brackets`
-
-Put spaces within non-empty parentheses
-
-- **Default value**: `false`
-- **Possible values**: `true`, `false`
-
-#### `false` (default):
-
-```rust
+// non-empty parentheses
fn lorem<T: Eq>(t: T) {
let lorem = (ipsum, dolor);
}
+
+// non-empty square brackets
+let lorem: [usize; 2] = [ipsum, dolor];
```
#### `true`:
```rust
+// generic arguments
+fn lorem< T: Eq >(t: T) {
+ // body
+}
+
+// non-empty parentheses
fn lorem<T: Eq>( t: T ) {
let lorem = ( ipsum, dolor );
}
-```
-
-See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
-
-## `spaces_within_parens_and_brackets`
-
-Put spaces within non-empty square brackets
-
-- **Default value**: `false`
-- **Possible values**: `true`, `false`
-
-#### `false` (default):
-
-```rust
-let lorem: [usize; 2] = [ipsum, dolor];
-```
-#### `true`:
-
-```rust
+// non-empty square brackets
let lorem: [ usize; 2 ] = [ ipsum, dolor ];
```
-See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
-
## `struct_lit_single_line`
Put small struct literals on a single line
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `true` (default):
};
```
-See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width).
-
-## `struct_lit_width`
-
-Maximum width in the body of a struct lit before falling back to vertical formatting
-
-- **Default value**: `18`
-- **Possible values**: any positive integer
-
-**Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
-
-#### Lines shorter than `struct_lit_width`:
-```rust
-let lorem = Lorem { ipsum: dolor, sit: amet };
-```
-
-#### Lines longer than `struct_lit_width`:
-See [`indent_style`](#indent_style).
-
-See also: [`struct_lit_single_line`](#struct_lit_single_line), [`indent_style`](#indent_style).
+See also: [`indent_style`](#indent_style).
-## `struct_variant_width`
-
-Maximum width in the body of a struct variant before falling back to vertical formatting
-
-- **Default value**: `35`
-- **Possible values**: any positive integer
-
-**Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
-
-#### Struct variants shorter than `struct_variant_width`:
-```rust
-enum Lorem {
- Ipsum,
- Dolor(bool),
- Sit { amet: Consectetur, adipiscing: Elit },
-}
-```
-
-#### Struct variants longer than `struct_variant_width`:
-```rust
-enum Lorem {
- Ipsum,
- Dolor(bool),
- Sit {
- amet: Consectetur,
- adipiscing: Elit,
- },
-}
-```
## `tab_spaces`
- **Default value**: `4`
- **Possible values**: any positive integer
+- **Stable**: Yes
#### `4` (default):
- **Default value**: `"Vertical"`
- **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
+- **Stable**: No
#### `"Vertical"` (default):
- **Default value**: `true`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `true` (default):
```rust
- **Default value**: `"Wide"`
- **Possible values**: `"Compressed"`, `"Wide"`
+- **Stable**: No
#### `"Wide"` (default):
- **Default value**: `false`
- **Possible values**: `true`, `false`
+- **Stable**: No
#### `false` (default):
let lorem = ipsum.map(|dolor| dolor.sit())?;
```
-## `where_density`
-Density of a where clause.
+## `wrap_comments`
-- **Default value**: `"Vertical"`
-- **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
+Break comments to fit on the line
-#### `"Vertical"` (default):
+- **Default value**: `false`
+- **Possible values**: `true`, `false`
+- **Stable**: Yes
+
+#### `false` (default):
```rust
-trait Lorem {
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where
- Dolor: Eq;
-
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where
- Dolor: Eq,
- {
- // body
- }
-}
+// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
```
-**Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
-
-#### `"CompressedIfEmpty"`:
+#### `true`:
```rust
-trait Lorem {
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where Dolor: Eq;
-
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where
- Dolor: Eq,
- {
- // body
- }
-}
+// Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+// sed do eiusmod tempor incididunt ut labore et dolore
+// magna aliqua. Ut enim ad minim veniam, quis nostrud
+// exercitation ullamco laboris nisi ut aliquip ex ea
+// commodo consequat.
```
-#### `"Compressed"`:
+## `match_arm_blocks`
-```rust
-trait Lorem {
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where Dolor: Eq;
+Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where Dolor: Eq {
- // body
+- **Default value**: `true`
+- **Possible values**: `true`, `false`
+- **Stable**: No
+
+#### `true` (default):
+
+```rust
+match lorem {
+ true => {
+ foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
}
+ false => println!("{}", sit),
}
```
-#### `"Tall"`:
+#### `false`:
```rust
-trait Lorem {
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where
- Dolor: Eq;
-
- fn ipsum<Dolor>(dolor: Dolor) -> Sit
- where
- Dolor: Eq,
- {
- // body
- }
+match lorem {
+ true =>
+ foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
+ false => println!("{}", sit),
}
```
-**Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
+See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
-See also: [`where_layout`](#where_layout), [`indent_style`](#indent_style).
+## `write_mode`
-## `where_layout`
+What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
-Element layout inside a where clause
+- **Default value**: `"Overwrite"`
+- **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
+- **Stable**: No
-- **Default value**: `"Vertical"`
-- **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
+## `blank_lines_upper_bound`
-#### `"Vertical"` (default):
+Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
+lines are found, they are trimmed down to match this integer.
-```rust
-fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
- where Ipsum: IpsumDolorSitAmet,
- Dolor: DolorSitAmetConsectetur
-{
- // body
-}
+- **Default value**: `1`
+- **Possible values**: *unsigned integer*
+- **Stable**: No
-fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
- where Ipsum: IpsumDolorSitAmet,
- Dolor: DolorSitAmetConsectetur,
- Sit: SitAmetConsecteturAdipiscing,
- Amet: AmetConsecteturAdipiscingElit
-{
- // body
-}
-```
-
-#### `"Horizontal"`:
+### Example
+Original Code:
```rust
-fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
- where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
-{
- // body
+fn foo() {
+ println!("a");
}
-fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
- where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
-{
- // body
-}
-```
-#### `"HorizontalVertical"`:
-```rust
-fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
- where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
-{
- // body
-}
+fn bar() {
+ println!("b");
-fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
- where Ipsum: IpsumDolorSitAmet,
- Dolor: DolorSitAmetConsectetur,
- Sit: SitAmetConsecteturAdipiscing,
- Amet: AmetConsecteturAdipiscingElit
-{
- // body
+
+ println!("c");
}
```
-#### `"Mixed"`:
-
+#### `1` (default):
```rust
-fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
- where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
-{
- // body
+fn foo() {
+ println!("a");
}
-fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
- where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
- Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
-{
- // body
+fn bar() {
+ println!("b");
+
+ println!("c");
}
```
-See also: [`where_density`](#where_density), [`indent_style`](#indent_style).
-
-## `wrap_comments`
+#### `2` (default):
+```rust
+fn foo() {
+ println!("a");
+}
-Break comments to fit on the line
-- **Default value**: `false`
-- **Possible values**: `true`, `false`
+fn bar() {
+ println!("b");
-#### `false` (default):
-```rust
-// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+ println!("c");
+}
```
-#### `true`:
+See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
-```rust
-// Lorem ipsum dolor sit amet, consectetur adipiscing elit,
-// sed do eiusmod tempor incididunt ut labore et dolore
-// magna aliqua. Ut enim ad minim veniam, quis nostrud
-// exercitation ullamco laboris nisi ut aliquip ex ea
-// commodo consequat.
-```
+## `blank_lines_lower_bound`
-## `wrap_match_arms`
-
-Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
+Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
+them, additional blank lines are inserted.
-- **Default value**: `true`
-- **Possible values**: `true`, `false`
+- **Default value**: `0`
+- **Possible values**: *unsigned integer*
+- **Stable**: No
-#### `true` (default):
+### Example
+Original Code (rustfmt will not change it with the default value of `0`):
```rust
-match lorem {
- true => {
- foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
- }
- false => println!("{}", sit),
+fn foo() {
+ println!("a");
+}
+fn bar() {
+ println!("b");
+ println!("c");
}
```
-#### `false`:
-
+#### `1`
```rust
-match lorem {
- true =>
- foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
- false => println!("{}", sit),
-}
-```
+fn foo() {
-See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
+ println!("a");
+}
-## `write_mode`
+fn bar() {
-What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
+ println!("b");
-- **Default value**: `"Overwrite"`
-- **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
+ println!("c");
+}
+```