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
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1862,6 +1862,42 @@ fn foo() {
1862
1862
}
1863
1863
```
1864
1864
1865
+
## `match_arm_indent`
1866
+
1867
+
Controls whether match arms are indented. If disabled, match arms will be formatted at the same indentation level as the outer `match` statement. Meaning that match blocks will only be indented once, not twice.
1868
+
1869
+
-**Default value**: `true`
1870
+
-**Possible values**: `true`, `false`
1871
+
-**Stable**: No (tracking issue: [#6533](https://github.com/rust-lang/rustfmt/issues/6533))
1872
+
1873
+
#### `true` (default):
1874
+
1875
+
```rust
1876
+
fnmain() {
1877
+
matchvalue {
1878
+
Enum::A=> {
1879
+
letmutwork=first();
1880
+
work+=second();
1881
+
}
1882
+
Enum::B=>short_work(),
1883
+
}
1884
+
}
1885
+
```
1886
+
1887
+
#### `false`:
1888
+
1889
+
```rust
1890
+
fnmain() {
1891
+
matchvalue {
1892
+
Enum::A=> {
1893
+
letmutwork=first();
1894
+
work+=second();
1895
+
}
1896
+
Enum::B=>short_work(),
1897
+
}
1898
+
}
1899
+
```
1900
+
1865
1901
## `match_block_trailing_comma`
1866
1902
1867
1903
Put a trailing comma after a block based match arm (non-block arms are not affected)
Copy file name to clipboardExpand all lines: README.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,8 +172,7 @@ See [GitHub page](https://rust-lang.github.io/rustfmt/) for details.
172
172
173
173
The `edition` option determines the Rust language edition used for parsing the code. This is important for syntax compatibility but does not directly control formatting behavior (see [Style Editions](#style-editions)).
174
174
175
-
When running `cargo fmt`, the `edition` is automatically read from the `Cargo.toml` file. However, when running `rustfmt` directly the `edition` defaults to 2015 if not explicitly configured. For consistent parsing between rustfmt and `cargo fmt` you should configure the `edition`.
176
-
For example in your `rustfmt.toml` file:
175
+
When running `cargo fmt`, the `edition` is automatically read from the `Cargo.toml` file. However, when running `rustfmt` directly, the `edition` defaults to 2015. For consistent parsing between rustfmt and `cargo fmt`, you should configure the `edition` in your `rustfmt.toml` file:
0 commit comments