File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ history of the style guide. Notable changes in the Rust 2024 style edition
37
37
include:
38
38
39
39
- Miscellaneous ` rustfmt ` bugfixes.
40
+ - Format single associated type ` where ` clauses on the same line if they fit.
40
41
41
42
## Rust 2015/2018/2021 style edition
42
43
Original file line number Diff line number Diff line change @@ -421,9 +421,20 @@ Format associated types like type aliases. Where an associated type has a
421
421
bound, put a space after the colon but not before:
422
422
423
423
``` rust
424
- pub type Foo : Bar ;
424
+ type Foo : Bar ;
425
425
```
426
426
427
+ If an associated type declaration has no bounds, and has a ` where ` clause with
428
+ a single entry, format the entire type declaration including the ` where ` clause
429
+ on the same line if it fits:
430
+
431
+ ``` rust
432
+ type Item <'a > where Self : 'a ;
433
+ ```
434
+
435
+ If the ` where ` clause contains multiple entries, or the associated type has any
436
+ bounds, format it across multiple lines as with a type alias.
437
+
427
438
## extern items
428
439
429
440
When writing extern items (such as ` extern "C" fn ` ), always specify the ABI.
You can’t perform that action at this time.
0 commit comments