You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Original comment indentation for trailing comments within an `if` is now taken into account when determining the indentation level to use for the trailing comment in formatted code. This does not modify any existing code formatted with rustfmt; it simply gives the programmer discretion to specify whether the comment is associated to the `else` block, or if the trailing comment is just a member of the `if` block. ([#1575](https://github.com/rust-lang/rustfmt/issues/1575), [#4120](https://github.com/rust-lang/rustfmt/issues/4120), [#4506](https://github.com/rust-lang/rustfmt/issues/4506))
179
+
- Original comment indentation for trailing comments within an `if` is now taken into account when determining the indentation level to use for the trailing comment in formatted code. This does not modify any existing code formatted with rustfmt; it simply gives the programmer discretion to specify whether the comment is associated to the `else` block, or if the trailing comment is just a member of the `if` block. ([#1575](https://github.com/rust-lang/rustfmt/issues/1575), [#4120](https://github.com/rust-lang/rustfmt/issues/4120), [#4506](https://github.com/rust-lang/rustfmt/issues/4506))
180
180
181
181
In this example the `// else comment` refers to the `else`:
182
182
```rust
@@ -213,7 +213,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
213
213
214
214
### Fixed
215
215
- Formatting of empty blocks with attributes which only contained comments is no longer butchered.([#4475](https://github.com/rust-lang/rustfmt/issues/4475), [#4467](https://github.com/rust-lang/rustfmt/issues/4467), [#4452](https://github.com/rust-lang/rustfmt/issues/4452#issuecomment-705886282), [#4522](https://github.com/rust-lang/rustfmt/issues/4522))
216
-
- Indentation of trailing comments in non-empty extern blocks is now correct. ([#4120](https://github.com/rust-lang/rustfmt/issues/4120#issuecomment-696491872))
216
+
- Indentation of trailing comments in non-empty extern blocks is now correct. ([#4120](https://github.com/rust-lang/rustfmt/issues/4120#issuecomment-696491872))
217
217
218
218
### Install/Download Options
219
219
-**crates.io package** - *pending*
@@ -297,7 +297,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
297
297
- Fix aligning comments of different group
298
298
- Fix flattening imports with a single `self`.
299
299
- Fix removing attributes on function parameters.
300
-
- Fix removing `impl` keyword from opaque type.
300
+
- Fix removing `impl` keyword from opaque type.
301
301
302
302
## [1.4.8] 2019-09-08
303
303
@@ -329,7 +329,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
329
329
330
330
- Add `--message-format` command line option to `cargo-fmt`.
331
331
- Add `-l,--files-with-diff` command line option to `rustfmt`.
332
-
- Add `json` emit mode.
332
+
- Add `json` emit mode.
333
333
334
334
### Fixed
335
335
@@ -380,7 +380,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
380
380
381
381
### Added
382
382
383
-
- Add new attribute `rustfmt::skip::attributes` to prevent rustfmt
383
+
- Add new attribute `rustfmt::skip::attributes` to prevent rustfmt
Copy file name to clipboardexpand all lines: src/tools/rustfmt/Configurations.md
+16-16
Original file line number
Diff line number
Diff line change
@@ -17,27 +17,27 @@ To enable unstable options, set `unstable_features = true` in `rustfmt.toml` or
17
17
18
18
Below you find a detailed visual guide on all the supported configuration options of rustfmt:
19
19
20
-
## `array_width`
20
+
## `array_width`
21
21
22
22
Maximum width of an array literal before falling back to vertical formatting.
23
23
24
24
-**Default value**: `60`
25
25
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
26
26
-**Stable**: Yes
27
27
28
-
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `array_width` will take precedence.
28
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `array_width` will take precedence.
29
29
30
30
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
31
31
32
-
## `attr_fn_like_width`
32
+
## `attr_fn_like_width`
33
33
34
34
Maximum width of the args of a function-like attributes before falling back to vertical formatting.
35
35
36
36
-**Default value**: `70`
37
37
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
38
38
-**Stable**: Yes
39
39
40
-
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `attr_fn_like_width` will take precedence.
40
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `attr_fn_like_width` will take precedence.
41
41
42
42
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
43
43
@@ -295,15 +295,15 @@ where
295
295
}
296
296
```
297
297
298
-
## `chain_width`
298
+
## `chain_width`
299
299
300
300
Maximum width of a chain to fit on one line.
301
301
302
302
-**Default value**: `60`
303
303
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
304
304
-**Stable**: Yes
305
305
306
-
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `chain_width` will take precedence.
306
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `chain_width` will take precedence.
307
307
308
308
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
309
309
@@ -751,15 +751,15 @@ trait Lorem {
751
751
}
752
752
```
753
753
754
-
## `fn_call_width`
754
+
## `fn_call_width`
755
755
756
756
Maximum width of the args of a function call before falling back to vertical formatting.
757
757
758
758
-**Default value**: `60`
759
759
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
760
760
-**Stable**: Yes
761
761
762
-
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `fn_call_width` will take precedence.
762
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `fn_call_width` will take precedence.
763
763
764
764
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
765
765
@@ -2124,15 +2124,15 @@ Don't reformat out of line modules
2124
2124
-**Possible values**: `true`, `false`
2125
2125
-**Stable**: No (tracking issue: #3389)
2126
2126
2127
-
## `single_line_if_else_max_width`
2127
+
## `single_line_if_else_max_width`
2128
2128
2129
2129
Maximum line length for single line if-else expressions. A value of `0` (zero) results in if-else expressions always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
2130
2130
2131
2131
-**Default value**: `50`
2132
2132
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
2133
2133
-**Stable**: Yes
2134
2134
2135
-
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `single_line_if_else_max_width` will take precedence.
2135
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `single_line_if_else_max_width` will take precedence.
2136
2136
2137
2137
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
2138
2138
@@ -2313,27 +2313,27 @@ fn main() {
2313
2313
2314
2314
See also: [`indent_style`](#indent_style).
2315
2315
2316
-
## `struct_lit_width`
2316
+
## `struct_lit_width`
2317
2317
2318
2318
Maximum width in the body of a struct literal before falling back to vertical formatting. A value of `0` (zero) results in struct literals always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
2319
2319
2320
2320
-**Default value**: `18`
2321
2321
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
2322
2322
-**Stable**: Yes
2323
2323
2324
-
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_lit_width` will take precedence.
2324
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_lit_width` will take precedence.
2325
2325
2326
2326
See also [`max_width`](#max_width), [`use_small_heuristics`](#use_small_heuristics), and [`struct_lit_single_line`](#struct_lit_single_line)
2327
2327
2328
-
## `struct_variant_width`
2328
+
## `struct_variant_width`
2329
2329
2330
2330
Maximum width in the body of a struct variant before falling back to vertical formatting. A value of `0` (zero) results in struct literals always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
2331
2331
2332
2332
-**Default value**: `35`
2333
2333
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
2334
2334
-**Stable**: Yes
2335
2335
2336
-
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_variant_width` will take precedence.
2336
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_variant_width` will take precedence.
2337
2337
2338
2338
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
2339
2339
@@ -2530,7 +2530,7 @@ fn main() {
2530
2530
2531
2531
This option can be used to simplify the management and bulk updates of the granular width configuration settings ([`fn_call_width`](#fn_call_width), [`attr_fn_like_width`](#attr_fn_like_width), [`struct_lit_width`](#struct_lit_width), [`struct_variant_width`](#struct_variant_width), [`array_width`](#array_width), [`chain_width`](#chain_width), [`single_line_if_else_max_width`](#single_line_if_else_max_width)), that respectively control when formatted constructs are multi-lined/vertical based on width.
2532
2532
2533
-
Note that explicitly provided values for the width configuration settings take precedence and override the calculated values determined by `use_small_heuristics`.
2533
+
Note that explicitly provided values for the width configuration settings take precedence and override the calculated values determined by `use_small_heuristics`.
When `use_small_heuristics` is set to `Off`, the granular width settings are functionally disabled and ignored. See the documentation for the respective width config options for specifics.
2598
+
When `use_small_heuristics` is set to `Off`, the granular width settings are functionally disabled and ignored. See the documentation for the respective width config options for specifics.
0 commit comments