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: CHANGELOG.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,38 @@
1
1
# Changelog
2
2
3
+
## [Unreleased]
4
+
5
+
6
+
## [1.9.0] 2025-01-03
7
+
8
+
### Fixed
9
+
- No longer strip `r#` prefix from `break` and `continue` labels [#6411](https://github.com/rust-lang/rustfmt/issues/6411)
10
+
```rust
11
+
fnmain() {
12
+
'r#if: {
13
+
break 'r#if;
14
+
}
15
+
}
16
+
```
17
+
- Fix panic when sorting imports [#6333](https://github.com/rust-lang/rustfmt/issues/6333)
18
+
- Fix issue with `wrap_comments` invalidating code blocks [#6417](https://github.com/rust-lang/rustfmt/pull/6417)
19
+
- No longer remove closure block label within a macro call [#6465](https://github.com/rust-lang/rustfmt/issues/6465)
20
+
21
+
### Changed
22
+
- Stabilize `style_edition=2024` and stabilize the `style_edition` command line option [#6431](https://github.com/rust-lang/rustfmt/pull/6431)[rust-lang/rust#134929](https://github.com/rust-lang/rust/pull/134929)
23
+
- Apply version sorting to module declarations when using `style_edition=2024`[#6368](https://github.com/rust-lang/rustfmt/pull/6368)
24
+
- When users set the deprecated `version` config, rustfmt now gives a hint about which equivalent `style_edition` they should use [#6361](https://github.com/rust-lang/rustfmt/pull/6361)
25
+
- Correct version chunk splitting in the internal version sort algorithm [#6407](https://github.com/rust-lang/rustfmt/pull/6407)
26
+
- Extend support for single line let-chain formatting to include cases where the left hand side operand is a literal, in alignment with finalized style rules as part of let-chain stabilization [#6492](https://github.com/rust-lang/rustfmt/pull/6492)
27
+
- Begin initial formatting for `use closures` and `use chains` (`#![feature(ergonomic_clones)]`). Previously, the closure and chain was left as the developer wrote it [#6532](https://github.com/rust-lang/rustfmt/pull/6532)
28
+
29
+
### Added
30
+
- Add `style_edition=2027` to gate unstable formatting [#6324](https://github.com/rust-lang/rustfmt/pull/6324)
31
+
- Support discovering and formatting files via external mods imported within `cfg_match`, similar to `cfg_if` behavior [#6522](https://github.com/rust-lang/rustfmt/pull/6522)
32
+
- Add new nightly-only `match_arm_indent` option [#6525](https://github.com/rust-lang/rustfmt/pull/6525)
33
+
- more details in the [configuration section for this new option](https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#match_arm_indent)
Copy file name to clipboardExpand all lines: Configurations.md
+38-1Lines changed: 38 additions & 1 deletion
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