@@ -378,15 +378,38 @@ type VeryLongType<T, U: SomeBound>
378378```
379379
380380Where possible avoid ` where ` clauses and keep type constraints inline. Where
381- that is not possible split the line before and after the ` where ` clause (and
382- split the ` where ` clause as normal), e.g.,
381+ that is not possible, prefer a trailing ` where ` clause over one that precedes
382+ the type. Split the line before and after a trailing ` where ` clause (and split
383+ the ` where ` clause as normal) and indent before the ` = ` and type, e.g.,
383384
384385``` rust
385386type VeryLongType <T , U >
387+ = AnEvenLongerType <T , U , Foo <T >>
388+ where
389+ T : U :: AnAssociatedType ,
390+ U : SomeBound ;
391+ ```
392+
393+ When there is a ` where ` clause before the type, format it normally, and break
394+ after the last clause. Do not indent before the ` = ` to leave it visually
395+ distinct from the indented clauses.
396+
397+ ```
398+ type WithPrecedingWC<T, U>
386399where
387400 T: U::AnAssociatedType,
388401 U: SomeBound,
389402= AnEvenLongerType<T, U, Foo<T>>;
403+
404+ // Or with both a preceding and trailing where clause.
405+ type WithPrecedingWC<T, U>
406+ where
407+ T: U::AnAssociatedType,
408+ U: SomeBound,
409+ = AnEvenLongerType<T, U, Foo<T>>
410+ where
411+ T: U::AnAssociatedType2,
412+ U: SomeBound2;
390413```
391414
392415## Associated types
0 commit comments