A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this:
```toml
-array_indent = "Block"
+indent_style = "Block"
array_width = 80
reorder_imported_names = true
```
- **Default value**: `0`
- **Possible values**: any positive integer
-**Note:** A value of `0` results in [`array_indent`](#array_indent) being applied regardless of a line's width.
+**Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width.
#### `0` (default):
];
```
-## `array_indent`
+## `indent_style`
-Indent on arrays
+Indent on expressions or items.
- **Default value**: `"Block"`
- **Possible values**: `"Block"`, `"Visual"`
+### Array
+
#### `"Block"` (default):
```rust
"elit"];
```
+### Control flow
+
+#### `"Block"` (default):
+
+```rust
+if lorem_ipsum &&
+ dolor_sit &&
+ amet_consectetur
+{
+ // ...
+}
+```
+
+#### `"Visual"`:
+
+```rust
+if lorem_ipsum &&
+ dolor_sit &&
+ amet_consectetur {
+ // ...
+}
+```
+
+See also: [`control_brace_style`](#control_brace_style).
+
+### Function arguments
+
+#### `"Block"` (default):
+
+```rust
+fn lorem() {}
+
+fn lorem(ipsum: usize) {}
+
+fn lorem(
+ ipsum: usize,
+ dolor: usize,
+ sit: usize,
+ amet: usize,
+ consectetur: usize,
+ adipiscing: usize,
+ elit: usize,
+) {
+ // body
+}
+```
+
+#### `"Visual"`:
+
+```rust
+fn lorem() {}
+
+fn lorem(ipsum: usize) {}
+
+fn lorem(ipsum: usize,
+ dolor: usize,
+ sit: usize,
+ amet: usize,
+ consectetur: usize,
+ adipiscing: usize,
+ elit: usize) {
+ // body
+}
+```
+
+### Functaion calls
+
+#### `"Block"` (default):
+
+```rust
+lorem(
+ "lorem",
+ "ipsum",
+ "dolor",
+ "sit",
+ "amet",
+ "consectetur",
+ "adipiscing",
+ "elit",
+);
+```
+
+#### `"Visual"`:
+
+```rust
+lorem("lorem",
+ "ipsum",
+ "dolor",
+ "sit",
+ "amet",
+ "consectetur",
+ "adipiscing",
+ "elit");
+```
+
+### Generics
+
+#### `"Block"` (default):
+
+```rust
+fn lorem<
+ Ipsum: Eq = usize,
+ Dolor: Eq = usize,
+ Sit: Eq = usize,
+ Amet: Eq = usize,
+ Adipiscing: Eq = usize,
+ Consectetur: Eq = usize,
+ Elit: Eq = usize
+>(
+ ipsum: Ipsum,
+ dolor: Dolor,
+ sit: Sit,
+ amet: Amet,
+ adipiscing: Adipiscing,
+ consectetur: Consectetur,
+ elit: Elit,
+) -> T {
+ // body
+}
+```
+
+#### `"Visual"`:
+
+```rust
+fn lorem<Ipsum: Eq = usize,
+ Dolor: Eq = usize,
+ Sit: Eq = usize,
+ Amet: Eq = usize,
+ Adipiscing: Eq = usize,
+ Consectetur: Eq = usize,
+ Elit: Eq = usize>
+ (ipsum: Ipsum,
+ dolor: Dolor,
+ sit: Sit,
+ amet: Amet,
+ adipiscing: Adipiscing,
+ consectetur: Consectetur,
+ elit: Elit)
+ -> T {
+ // body
+}
+```
+
+#### Struct
+
+#### `"Block"` (default):
+
+```rust
+let lorem = Lorem {
+ ipsum: dolor,
+ sit: amet,
+};
+```
+
+#### `"Visual"`:
+
+```rust
+let lorem = Lorem { ipsum: dolor,
+ sit: amet, };
+```
+
+See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style).
+
+### Where predicates
+
+#### `"Block"` (default):
+
+```rust
+fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
+where
+ Ipsum: Eq,
+ Dolor: Eq,
+ Sit: Eq,
+ Amet: Eq
+{
+ // body
+}
+```
+
+#### `"Visual"`:
+
+```rust
+fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
+ where Ipsum: Eq,
+ Dolor: Eq,
+ Sit: Eq,
+ Amet: Eq
+{
+ // body
+}
+```
+
+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 [`array_indent`](#array_indent) being applied regardless of a line's width.
+**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
```
#### Lines longer than `array_width`:
-See [`array_indent`](#array_indent).
+See [`indent_style`](#indent_style).
## `attributes_on_same_line_as_field`
let (lorem, ipsum, ..) = (1, 2, 3, 4);
```
-## `control_style`
+## `indent_style`
Indent style for control flow statements
- **Default value**: `"Rfc"`
- **Possible values**: `"Rfc"`, `"Legacy"`
-#### `"Rfc"` (default):
-
-```rust
-if lorem_ipsum &&
- dolor_sit &&
- amet_consectetur
-{
- // ...
-}
-```
-
-#### `"Legacy"`:
-
-```rust
-if lorem_ipsum &&
- dolor_sit &&
- amet_consectetur {
- // ...
-}
-```
-
-See also: [`control_brace_style`](#control_brace_style).
-
## `control_brace_style`
Brace style for control flow constructs
}
```
-## `fn_args_indent`
-
-Layout of function arguments and tuple structs
-
-- **Default value**: `"Block"`
-- **Possible values**: `"Block"`, `"Visual"`
-
-#### `"Block"` (default):
-
-```rust
-fn lorem() {}
-
-fn lorem(ipsum: usize) {}
-
-fn lorem(
- ipsum: usize,
- dolor: usize,
- sit: usize,
- amet: usize,
- consectetur: usize,
- adipiscing: usize,
- elit: usize,
-) {
- // body
-}
-```
-
-#### `"Visual"`:
-
-```rust
-fn lorem() {}
-
-fn lorem(ipsum: usize) {}
-
-fn lorem(ipsum: usize,
- dolor: usize,
- sit: usize,
- amet: usize,
- consectetur: usize,
- adipiscing: usize,
- elit: usize) {
- // body
-}
-```
-
## `fn_args_paren_newline`
If function argument parenthesis goes on a newline
}
```
-## `fn_call_indent`
-
-Indentation for function calls, etc.
-
-- **Default value**: `"Block"`
-- **Possible values**: `"Block"`, `"Visual"`
-
-#### `"Block"` (default):
-
-```rust
-lorem(
- "lorem",
- "ipsum",
- "dolor",
- "sit",
- "amet",
- "consectetur",
- "adipiscing",
- "elit",
-);
-```
-
-#### `"Visual"`:
-
-```rust
-lorem("lorem",
- "ipsum",
- "dolor",
- "sit",
- "amet",
- "consectetur",
- "adipiscing",
- "elit");
-```
-
## `fn_call_width`
Maximum width of the args of a function call before falling back to vertical formatting
#### Function call longer than `fn_call_width`:
-See [`fn_call_indent`](#fn_call_indent).
+See [`indent_style`](#indent_style).
## `fn_empty_single_line`
```
-**Note**: This option only takes effect when `fn_call_indent` is set to `"Visual"`.
+**Note**: This option only takes effect when `indent_style` is set to `"Visual"`.
## `fn_single_line`
See also [`force_format_strings`](#force_format_strings), [`max_width`](#max_width).
-## `generics_indent`
-
-Indentation of generics
-
-- **Default value**: `"Block"`
-- **Possible values**: `"Block"`, `"Visual"`
-
-#### `"Block"` (default):
-
-```rust
-fn lorem<
- Ipsum: Eq = usize,
- Dolor: Eq = usize,
- Sit: Eq = usize,
- Amet: Eq = usize,
- Adipiscing: Eq = usize,
- Consectetur: Eq = usize,
- Elit: Eq = usize
->(
- ipsum: Ipsum,
- dolor: Dolor,
- sit: Sit,
- amet: Amet,
- adipiscing: Adipiscing,
- consectetur: Consectetur,
- elit: Elit,
-) -> T {
- // body
-}
-```
-
-#### `"Visual"`:
-
-```rust
-fn lorem<Ipsum: Eq = usize,
- Dolor: Eq = usize,
- Sit: Eq = usize,
- Amet: Eq = usize,
- Adipiscing: Eq = usize,
- Consectetur: Eq = usize,
- Elit: Eq = usize>
- (ipsum: Ipsum,
- dolor: Dolor,
- sit: Sit,
- amet: Amet,
- adipiscing: Adipiscing,
- consectetur: Consectetur,
- elit: Elit)
- -> T {
- // body
-}
-```
-
## `hard_tabs`
Use tab characters for indentation, spaces for alignment
};
```
-See also: [`struct_lit_indent`](#struct_lit_indent), [`struct_lit_width`](#struct_lit_width).
-
-## `struct_lit_indent`
-
-Style of struct definition
-
-- **Default value**: `"Block"`
-- **Possible values**: `"Block"`, `"Visual"`
-
-#### `"Block"` (default):
-
-```rust
-let lorem = Lorem {
- ipsum: dolor,
- sit: amet,
-};
-```
-
-#### `"Visual"`:
-
-```rust
-let lorem = Lorem { ipsum: dolor,
- sit: amet, };
-```
-
-See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
+See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width).
## `struct_lit_width`
```
#### Lines longer than `struct_lit_width`:
-See [`struct_lit_indent`](#struct_lit_indent).
+See [`indent_style`](#indent_style).
-See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
+See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style).
## `struct_variant_width`
**Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
-See also: [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
+See also: [`where_layout`](#where_layout), [`indent_style`](#indent_style).
## `where_layout`
}
```
-**Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
-
-See also: [`where_density`](#where_density), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
-
-## `where_pred_indent`
-
-Indentation style of a where predicate
-
-- **Default value**: `"Visual"`
-- **Possible values**: `"Block"`, `"Visual"`
-
-#### `"Visual"` (default):
-
-```rust
-fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
- where Ipsum: Eq,
- Dolor: Eq,
- Sit: Eq,
- Amet: Eq
-{
- // body
-}
-```
-
-#### `"Block"`:
-
-```rust
-fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
- where Ipsum: Eq,
- Dolor: Eq,
- Sit: Eq,
- Amet: Eq
-{
- // body
-}
-```
-
-**Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
-
-See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_style`](#where_style).
-
-## `where_style`
-
-Overall strategy for where clauses
-
-- **Default value**: `"Rfc"`
-- **Possible values**: `"Rfc"`, `"Legacy"`
-
-#### `"Rfc"` (default):
-
-```rust
-fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
-where
- Ipsum: Eq,
- Dolor: Eq,
- Sit: Eq,
- Amet: Eq,
-{
- // body
-}
-```
-
-#### `"Legacy"`:
-
-```rust
-fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
- where Ipsum: Eq,
- Dolor: Eq,
- Sit: Eq,
- Amet: Eq
-{
- // body
-}
-```
-
-See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent).
+See also: [`where_density`](#where_density), [`indent_style`](#indent_style).
## `wrap_comments`