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
Copy file name to clipboardExpand all lines: src/tools/rustfmt/CHANGELOG.md
+27-1
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,32 @@
2
2
3
3
## [Unreleased]
4
4
5
+
## [1.5.2] 2023-01-24
6
+
7
+
### Fixed
8
+
9
+
- Resolve issue when comments are found within const generic defaults in unit structs [#5668](https://github.com/rust-lang/rustfmt/issues/5668)
10
+
- Resolve issue when block comments are found within trait generics [#5358](https://github.com/rust-lang/rustfmt/issues/5358)
11
+
- Correctly handle alignment of comments containing unicode characters [#5504](https://github.com/rust-lang/rustfmt/issues/5504)
12
+
- Properly indent a single generic bound that requires being written across multiple lines [#4689](https://github.com/rust-lang/rustfmt/issues/4689) (n.b. this change is version gated and will only appear when the `version` configuration option is set to `Two`)
13
+
14
+
### Changed
15
+
16
+
- Renamed `fn_args_layout` configuration option to `fn_params_layout`[#4149](https://github.com/rust-lang/rustfmt/issues/4149). Note that `fn_args_layout` has only been soft deprecated: `fn_args_layout` will continue to work without issue, but rustfmt will display a warning to encourage users to switch to the new name
17
+
18
+
### Added
19
+
20
+
- New configuration option (`skip_macro_invocations`)[https://rust-lang.github.io/rustfmt/?version=master&search=#skip_macro_invocations][#5347](https://github.com/rust-lang/rustfmt/pull/5347) that can be used to globally define a single enumerated list of macro calls that rustfmt should skip formatting. rustfmt [currently also supports this via a custom tool attribute](https://github.com/rust-lang/rustfmt#tips), however, these cannot be used in all contexts because [custom inner attributes are unstable](https://github.com/rust-lang/rust/issues/54726)
21
+
22
+
### Misc
23
+
24
+
- rustfmt now internally supports the ability to have both stable and unstable variants of a configuration option [#5378](https://github.com/rust-lang/rustfmt/issues/5378). This ability will allow the rustfmt team to make certain configuration options available on stable toolchains more quickly because we no longer have to wait for _every_ variant to be stable-ready before stabilizing _any_ variant.
-**Build from source** - [Tag v1.5.2](https://github.com/rust-lang/rustfmt/tree/v1.5.2), see instructions for how to [install rustfmt from source][install-from-source]
30
+
5
31
## [1.5.1] 2022-06-24
6
32
7
33
**N.B** A bug was introduced in v1.5.0/nightly-2022-06-15 which modified formatting. If you happened to run rustfmt over your code with one of those ~10 nightlies it's possible you may have seen formatting changes, and you may see additional changes after this fix since that bug has now been reverted.
@@ -840,7 +866,7 @@ from formatting an attribute #3665
840
866
- Fix formatting of raw string literals #2983
841
867
- Handle chain with try operators with spaces #2986
842
868
- Use correct shape in Visual tuple rewriting #2987
843
-
-Impove formatting of arguments with `visual_style = "Visual"` option #2988
869
+
-Improve formatting of arguments with `visual_style = "Visual"` option #2988
844
870
- Change `print_diff` to output the correct line number 992b179
845
871
- Propagate errors about failing to rewrite a macro 6f318e3
846
872
- Handle formatting of long function signature #3010
Copy file name to clipboardExpand all lines: src/tools/rustfmt/Configurations.md
+179-6
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/1.0.4/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/4.0.0/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
@@ -425,7 +425,7 @@ fn example() {
425
425
426
426
## `comment_width`
427
427
428
-
Maximum length of comments. No effect unless`wrap_comments = true`.
428
+
Maximum length of comments. No effect unless`wrap_comments = true`.
429
429
430
430
-**Default value**: `80`
431
431
-**Possible values**: any positive integer
@@ -589,7 +589,7 @@ doesn't get ignored when aligning.
589
589
#### `0` (default):
590
590
591
591
```rust
592
-
enumBar {
592
+
enumFoo {
593
593
A=0,
594
594
Bb=1,
595
595
RandomLongVariantGoesHere=10,
@@ -645,7 +645,8 @@ trailing whitespaces.
645
645
646
646
## `fn_args_layout`
647
647
648
-
Control the layout of arguments in a function
648
+
This option is deprecated and has been renamed to `fn_params_layout` to better communicate that
649
+
it affects the layout of parameters in function signatures.
See also [`format_macro_matchers`](#format_macro_matchers).
1016
1130
1131
+
## `skip_macro_invocations`
1132
+
1133
+
Skip formatting the bodies of macro invocations with the following names.
1134
+
1135
+
rustfmt will not format any macro invocation for macros with names set in this list.
1136
+
Including the special value "*" will prevent any macro invocations from being formatted.
1137
+
1138
+
Note: This option does not have any impact on how rustfmt formats macro definitions.
1139
+
1140
+
-**Default value**: `[]`
1141
+
-**Possible values**: a list of macro name idents, `["name_0", "name_1", ..., "*"]`
1142
+
-**Stable**: No (tracking issue: [#5346](https://github.com/rust-lang/rustfmt/issues/5346))
1143
+
1144
+
#### `[]` (default):
1145
+
1146
+
rustfmt will follow its standard approach to formatting macro invocations.
1147
+
1148
+
No macro invocations will be skipped based on their name. More information about rustfmt's standard macro invocation formatting behavior can be found in [#5437](https://github.com/rust-lang/rustfmt/discussions/5437).
1149
+
1150
+
```rust
1151
+
lorem!(
1152
+
const_:u8=0;
1153
+
);
1154
+
1155
+
ipsum!(
1156
+
const_:u8=0;
1157
+
);
1158
+
```
1159
+
1160
+
#### `["lorem"]`:
1161
+
1162
+
The named macro invocations will be skipped.
1163
+
1164
+
```rust
1165
+
lorem!(
1166
+
const_:u8=0;
1167
+
);
1168
+
1169
+
ipsum!(
1170
+
const_:u8=0;
1171
+
);
1172
+
```
1173
+
1174
+
#### `["*"]`:
1175
+
1176
+
The special selector `*` will skip all macro invocations.
1177
+
1178
+
```rust
1179
+
lorem!(
1180
+
const_:u8=0;
1181
+
);
1182
+
1183
+
ipsum!(
1184
+
const_:u8=0;
1185
+
);
1186
+
```
1017
1187
1018
1188
## `format_strings`
1019
1189
@@ -1687,13 +1857,16 @@ pub enum Foo {}
1687
1857
1688
1858
## `imports_granularity`
1689
1859
1690
-
How imports should be grouped into `use` statements. Imports will be merged or split to the configured level of granularity.
1860
+
Controls how imports are structured in `use` statements. Imports will be merged or split to the configured level of granularity.
1861
+
1862
+
Similar to other `import` related configuration options, this option operates within the bounds of user-defined groups of imports. See [`group_imports`](#group_imports) for more information on import groups.
1863
+
1864
+
Note that rustfmt will not modify the granularity of imports containing comments if doing so could potentially lose or misplace said comments.
0 commit comments