Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/doc/style-guide/src/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,18 @@ let f = Foo {
};
```

Functional record update syntax is treated like a field, but it must never have
a trailing comma. Do not put a space after `..`.
Default intialization syntax is treated like a field, but it must never have a
trailing comma.

```rust
let f = Foo {
field1,
..
};
```

Functional record update syntax is treated the same. Do not put a space after
`..`.

```rust
let f = Foo {
Expand Down
11 changes: 8 additions & 3 deletions src/doc/style-guide/src/items.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,23 @@ indented and appears on its own line.
```rust
struct Foo {
a: A,
b: B,
b: B = expr,
}
```

If and only if the type of a field does not fit within the right margin, it is
pulled down to its own line and indented again.
pulled down to its own line and indented again. If and only if the default value
does not not fit within the right margin, split the line after the =. Also apply
a block indent if this was not already done by pulling down the type.

```rust
struct Foo {
a: A,
b: B =
long_expr,
long_name:
LongType,
LongType =
long_expr,
}
```

Expand Down
Loading