File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 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
3737include:
3838
3939- Miscellaneous ` rustfmt ` bugfixes.
40+ - Format single associated type ` where ` clauses on the same line if they fit.
4041
4142## Rust 2015/2018/2021 style edition
4243
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
421421bound, put a space after the colon but not before:
422422
423423``` rust
424- pub type Foo : Bar ;
424+ type Foo : Bar ;
425425```
426426
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+
427438## extern items
428439
429440When writing extern items (such as ` extern "C" fn ` ), always specify the ABI.
You can’t perform that action at this time.
0 commit comments