@@ -295,18 +295,8 @@ Prefer to use single-letter names for generic parameters.
295
295
296
296
These rules apply for `where ` clauses on any item .
297
297
298
- If a where clause is short , and appears on a short one - line function
299
- declaration with no body or on a short type with no `= `, format it on
300
- the same line as the declaration :
301
-
302
- ```rust
303
- fn new (& self ) -> Self where Self : Sized ;
304
-
305
- type Item <'a >: SomeTrait where Self : 'a ;
306
- ```
307
-
308
- Otherwise, if immediately following a closing bracket of any kind, write the
309
- keyword ` where ` on the same line, with a space before it.
298
+ If immediately following a closing bracket of any kind , write the keyword
299
+ `where ` on the same line , with a space before it .
310
300
311
301
Otherwise , put `where ` on a new line at the same indentation level . Put each
312
302
component of a `where ` clause on its own line , block - indented . Use a trailing
@@ -357,7 +347,7 @@ where
357
347
```
358
348
359
349
If a ` where ` clause is very short, prefer using an inline bound on the type
360
- parameter if possible .
350
+ parameter.
361
351
362
352
If a component of a ` where ` clause does not fit and contains ` + ` , break it
363
353
before each ` + ` and block-indent the continuation lines. Put each bound on its
@@ -431,21 +421,9 @@ Format associated types like type aliases. Where an associated type has a
431
421
bound, put a space after the colon but not before:
432
422
433
423
``` rust
434
- type Foo : Bar ;
424
+ pub type Foo : Bar ;
435
425
```
436
426
437
- If an associated type is short, has no ` = ` , and has a ` where ` clause with only
438
- one entry, format the entire type declaration including the ` where ` clause on
439
- the same line if it fits:
440
-
441
- ``` rust
442
- type Item <'a > where Self : 'a ;
443
- type Item <'a >: PartialEq + Send where Self : 'a ;
444
- ```
445
-
446
- If the associated type has a ` = ` , or if the ` where ` clause contains multiple
447
- entries, format it across multiple lines as with a type alias.
448
-
449
427
## extern items
450
428
451
429
When writing extern items (such as ` extern "C" fn ` ), always specify the ABI.
0 commit comments