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: Configurations.md
+173-3Lines changed: 173 additions & 3 deletions
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
@@ -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.
0 commit comments