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
- Prevent ICE when formatting `vec!{}`[#5735](https://github.com/rust-lang/rustfmt/issues/5735)
30
-
- Prevent internal trailing whitespace error when formatting an empty `macro_rules!`defintion e.g. `macro_rules! foo {}`[#5882](https://github.com/rust-lang/rustfmt/issues/5882)
31
+
- Prevent internal trailing whitespace error when formatting an empty `macro_rules!`definition e.g. `macro_rules! foo {}`[#5882](https://github.com/rust-lang/rustfmt/issues/5882)
31
32
- Formatting doc comment lines that start with `.` or `)` won't be treated as ordered markdown lists because `.` or `)` must be preceded by a number to start an ordered markdown list [#5835](https://github.com/rust-lang/rustfmt/pull/5835)
32
33
- Add parenthesis around closures when they're used as method receives, don't have a block body, and end with `.`[#4808](https://github.com/rust-lang/rustfmt/issues/4808)
33
34
```rust
@@ -184,7 +185,7 @@
184
185
185
186
- Simplify the rustfmt help text by eliding the full path to the rustfmt binary path from the usage string when running `rustfmt --help`[#5214](https://github.com/rust-lang/rustfmt/issues/5214)
186
187
187
-
- Bumped the version for serveral dependencies. Most notably `dirs``v2.0.1` -> `v4.0.0`. This changed the global user config directory on macOS from `$HOME/Library/Preferences` to `$HOME/Library/Application Support`[#5237](https://github.com/rust-lang/rustfmt/pull/5237)
188
+
- Bumped the version for several dependencies. Most notably `dirs``v2.0.1` -> `v4.0.0`. This changed the global user config directory on macOS from `$HOME/Library/Preferences` to `$HOME/Library/Application Support`[#5237](https://github.com/rust-lang/rustfmt/pull/5237)
188
189
189
190
### Fixed
190
191
@@ -942,7 +943,7 @@ from formatting an attribute #3665
942
943
943
944
### Fixed
944
945
945
-
- Do not remove path disambiugator inside macro #3142
946
+
- Do not remove path disambiguator inside macro #3142
946
947
- Improve handling of Windows newlines #3141
947
948
- Fix alignment of a struct's fields (`struct_field_align_threshold` option) with the Visual `indent_style`#3165
948
949
- Fix a bug in formatting markdown lists within comments #3172
@@ -1031,7 +1032,7 @@ from formatting an attribute #3665
1031
1032
1032
1033
### Changed
1033
1034
1034
-
- Replace '--conifig-help' with '--config=help' cb10e06
1035
+
- Replace '--config-help' with '--config=help' cb10e06
1035
1036
- Improve formatting of slice patterns #2912
1036
1037
1037
1038
### Fixed
@@ -1075,7 +1076,7 @@ from formatting an attribute #3665
1075
1076
- Add max_width option for all heuristics c2ae39e
1076
1077
- Add config option `format_macro_matchers` to format the metavariable matching patterns in macros 79c5ee8
1077
1078
- Add config option `format_macro_bodies` to format the bodies of macros 79c5ee8
1078
-
- Format exitential type fc307ff
1079
+
- Format existential type fc307ff
1079
1080
- Support raw identifiers in struct expressions f121b1a
1080
1081
- Format Async block and async function 0b25f60
1081
1082
@@ -1131,7 +1132,7 @@ from formatting an attribute #3665
1131
1132
1132
1133
### Changed
1133
1134
1134
-
- Update rustc-ap-syntax to 128.0.0 and ustc-ap-rustc_target to 128.0.0 195395f
1135
+
- Update rustc-ap-syntax to 128.0.0 and rustc-ap-rustc_target to 128.0.0 195395f
1135
1136
- Put operands on its own line when each fits in a single line f8439ce
Copy file name to clipboardExpand all lines: Configurations.md
+24-6Lines changed: 24 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Configuring Rustfmt
2
2
3
-
Rustfmt is designed to be very configurable. You can create a TOML file called `rustfmt.toml` or `.rustfmt.toml`, place it in the project or any other parent directory and it will apply the options in that file. If none of these directories contain such a file, both your home directory and a directory called `rustfmt` in your [global config directory](https://docs.rs/dirs/4.0.0/dirs/fn.config_dir.html) (e.g. `.config/rustfmt/`) are checked as well.
3
+
Rustfmt is designed to be very configurable. You can create a TOML file called `rustfmt.toml` or `.rustfmt.toml`, place it in the project or any other parent directory and it will apply the options in that file. If none of these directories contain such a file, both your home directory and a directory called `rustfmt` in your [global config directory](https://docs.rs/dirs/5.0.1/dirs/fn.config_dir.html) (e.g. `.config/rustfmt/`) are checked as well.
4
4
5
5
A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this:
6
6
@@ -1050,15 +1050,25 @@ Max width for code snippets included in doc comments. Only used if [`format_code
1050
1050
1051
1051
## `format_generated_files`
1052
1052
1053
-
Format generated files. A file is considered generated
1054
-
if any of the first five lines contain a `@generated` comment marker.
1053
+
Format generated files. A file is considered generated if any of the first several lines contain a `@generated` comment marker. The number of lines to check is configured by `generated_marker_line_search_limit`.
1054
+
1055
1055
By default, generated files are reformatted, i. e. `@generated` marker is ignored.
1056
1056
This option is currently ignored for stdin (`@generated` in stdin is ignored.)
1057
1057
1058
1058
-**Default value**: `true`
1059
1059
-**Possible values**: `true`, `false`
1060
1060
-**Stable**: No (tracking issue: [#5080](https://github.com/rust-lang/rustfmt/issues/5080))
1061
1061
1062
+
## `generated_marker_line_search_limit`
1063
+
1064
+
Number of lines to check for a `@generated` pragma header, starting from the top of the file. Setting this value to `0` will treat all files as non-generated. When`format_generated_files` is `true`, this option has no effect.
1065
+
1066
+
-**Default value**: `5`
1067
+
-**Possible values**: any positive integer
1068
+
-**Stable**: No (tracking issue: [#5080](https://github.com/rust-lang/rustfmt/issues/5080))
1069
+
1070
+
See also [format_generated_files](#format_generated_files) link here.
1071
+
1062
1072
## `format_macro_matchers`
1063
1073
1064
1074
Format the metavariable matching patterns in macros.
@@ -1098,7 +1108,7 @@ See also [`format_macro_bodies`](#format_macro_bodies).
1098
1108
1099
1109
## `format_macro_bodies`
1100
1110
1101
-
Format the bodies of macros.
1111
+
Format the bodies of declarative macro definitions.
1102
1112
1103
1113
-**Default value**: `true`
1104
1114
-**Possible values**: `true`, `false`
@@ -1248,12 +1258,20 @@ Control the case of the letters in hexadecimal literal values
1248
1258
1249
1259
## `hide_parse_errors`
1250
1260
1251
-
Do not show parse errors if the parser failed to parse files.
1261
+
This option is deprecated and has been renamed to `show_parse_errors`to avoid confusion around the double negative default of `hide_parse_errors=false`.
1252
1262
1253
1263
-**Default value**: `false`
1254
1264
-**Possible values**: `true`, `false`
1255
1265
-**Stable**: No (tracking issue: [#3390](https://github.com/rust-lang/rustfmt/issues/3390))
1256
1266
1267
+
## `show_parse_errors`
1268
+
1269
+
Show parse errors if the parser failed to parse files.
1270
+
1271
+
-**Default value**: `true`
1272
+
-**Possible values**: `true`, `false`
1273
+
-**Stable**: No (tracking issue: [#5977](https://github.com/rust-lang/rustfmt/issues/5977))
1274
+
1257
1275
## `ignore`
1258
1276
1259
1277
Skip formatting files and directories that match the specified pattern.
@@ -1655,7 +1673,7 @@ use core::slice;
1655
1673
1656
1674
Controls whether arm bodies are wrapped in cases where the first line of the body cannot fit on the same line as the `=>` operator.
1657
1675
1658
-
The Style Guide requires that bodies are block wrapped by default if a line break is required after the `=>`, but this option can be used to disable that behavior to prevent wrapping arm bodies in that event, so long as the body does not contain multiple statements nor line comments.
1676
+
The Style Guide requires that bodies are block wrapped by default if a line break is required after the `=>`, but this option can be used to disable that behavior to prevent wrapping arm bodies in that event, so long as the body contains neither multiple statements nor line comments.
0 commit comments