Skip to content

Commit 77c8349

Browse files
committed
Impls
cc #25
1 parent b366a83 commit 77c8349

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

guide/items.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,40 @@ pub trait IndexRanges:
198198
```
199199

200200

201+
### Impls
202+
203+
Impl items should be block indented. If there are no items, the impl may be
204+
formatted on a single line. Otherwise there should be line-breaks after the
205+
opening brace and before the closing brace:
206+
207+
```rust
208+
impl Foo {}
209+
210+
impl Bar for Foo {
211+
...
212+
}
213+
```
214+
215+
Avoid line-breaking in the signature if possible. If a line break is required in
216+
a non-inherent impl, break immediately before `for`, block indent the concrete type
217+
and put the opening brace on it's own line:
218+
219+
```rust
220+
impl Bar
221+
for Foo
222+
{
223+
...
224+
}
225+
```
226+
227+
201228
### Extern crate
202229

203230
`extern crate foo;`
204231

205232
Use spaces around keywords, no spaces around the semi-colon.
206233

234+
207235
### Modules
208236

209237
```rust

0 commit comments

Comments
 (0)