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
Auto merge of rust-lang#113225 - calebcartwright:sync-rustfmt, r=calebcartwright
Update Rustfmt (add let-else support)
Adds let-else formatting support
Bit more detail in: https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#160-2023-07-02
Accompanying blog post: rust-lang/blog.rust-lang.org#1117
I know we're getting close to tool week, however, there's been extensive discussion and testing of the changes in this between both t-style and t-rustfmt. Our confidence level is extremely high, and even if it's only on nightly for a few days, I'd still much prefer that and being able to get this out with 1.72 vs having to push to 1.73
Closesrust-lang/rustfmt#4914
cc `@rust-lang/style` for awareness
Copy file name to clipboardexpand all lines: src/tools/rustfmt/CHANGELOG.md
+11
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,17 @@
2
2
3
3
## [Unreleased]
4
4
5
+
6
+
## [1.6.0] 2023-07-02
7
+
8
+
### Added
9
+
10
+
- Support for formatting let-else statements [#5690]
11
+
- New config option, `single_line_let_else_max_width`, that allows users to configure the maximum length of single line `let-else` statements. `let-else` statements that otherwise meet the requirements to be formatted on a single line will have their divergent`else` block formatted over multiple lines if they exceed this length [#5684]
Copy file name to clipboardexpand all lines: src/tools/rustfmt/Configurations.md
+77
Original file line number
Diff line number
Diff line change
@@ -2392,6 +2392,78 @@ By default this option is set as a percentage of [`max_width`](#max_width) provi
2392
2392
2393
2393
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
2394
2394
2395
+
## `single_line_let_else_max_width`
2396
+
2397
+
Maximum line length for single line let-else statements.
2398
+
See the [let-else statement section of the Rust Style Guide](https://github.com/rust-lang/rust/blob/master/src/doc/style-guide/src/statements.md#else-blocks-let-else-statements) for more details on when a let-else statement may be written on a single line.
2399
+
A value of `0` (zero) means the divergent `else` block will always be formatted over multiple lines.
2400
+
Note this occurs when `use_small_heuristics` is set to `Off`.
2401
+
2402
+
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `single_line_let_else_max_width` will take precedence.
2403
+
2404
+
-**Default value**: `50`
2405
+
-**Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
0 commit comments