File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,33 @@ where
257
257
}
258
258
```
259
259
260
+
261
+ ### Type aliases
262
+
263
+ Type aliases should generally be kept on one line. If necessary to break the
264
+ line, do so after the ` = ` ; the right-hand-side should be block indented:
265
+
266
+ ``` rust
267
+ pub type Foo = Bar <T >;
268
+
269
+ // If multi-line is required
270
+ type VeryLongType <T , U : SomeBound > =
271
+ AnEvenLongerType <T , U , Foo <T >>;
272
+ ```
273
+
274
+ Where possible avoid ` where ` clauses and keep type constraints inline. Where
275
+ that is not possible split the line before and after the ` where ` clause (and
276
+ split the ` where ` clause as normal), e.g.,
277
+
278
+ ``` rust
279
+ type VeryLongType <T , U >
280
+ where
281
+ T : U :: AnAssociatedType ,
282
+ U : SomeBound ,
283
+ = AnEvenLongerType <T , U , Foo <T >>;
284
+ ```
285
+
286
+
260
287
### extern items
261
288
262
289
When writing extern items (such as ` extern "C" fn ` ), always be explicit about
You can’t perform that action at this time.
0 commit comments