File tree 1 file changed +26
-0
lines changed 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -110,3 +110,29 @@ Use `{}` for the full definition of the macro.
110
110
macro_rules! foo {
111
111
}
112
112
```
113
+
114
+
115
+ ### Type aliases
116
+
117
+ Type aliases should generally be kept on one line. If necessary to break the
118
+ line, do so after the ` = ` ; the right-hand-side should be block indented:
119
+
120
+ ``` rust
121
+ pub type Foo = Bar <T >;
122
+
123
+ // If multi-line is required
124
+ type VeryLongType <T , U : SomeBound > =
125
+ AnEvenLongerType <T , U , Foo <T >>;
126
+ ```
127
+
128
+ Where possible avoid ` where ` clauses and keep type constraints inline. Where
129
+ that is not possible split the line before and after the ` where ` clause (and
130
+ split the ` where ` clause as normal), e.g.,
131
+
132
+ ``` rust
133
+ type VeryLongType <T , U >
134
+ where
135
+ T : U :: AnAssociatedType ,
136
+ U : SomeBound ,
137
+ = AnEvenLongerType <T , U , Foo <T >>;
138
+ ```
You can’t perform that action at this time.
0 commit comments