Skip to content

Commit 24534cf

Browse files
committed
style-guide: Fix chain example to match rustfmt behavior
The style guide gave an example of breaking a multi-line chain element and all subsequent elements to a new line, but that same example and the accompanying text also had several chain items stacked on the first line. rustfmt doesn't do this, except when the rule saying to combine ``` shrt .y() ``` into ``` shrt.y() ``` applies.
1 parent 5dac6b3 commit 24534cf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/doc/style-guide/src/expressions.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,11 @@ foo(
450450

451451
#### Multi-line elements
452452

453-
If any element in a chain is formatted across multiple lines, then that element
454-
and any later elements must be on their own line. Earlier elements may be kept
455-
on a single line. E.g.,
453+
If any element in a chain is formatted across multiple lines, put that element
454+
and any later elements on their own lines.
456455

457456
```rust
458-
a.b.c()?.d
457+
a.b.c()?
459458
.foo(
460459
an_expr,
461460
another_expr,

0 commit comments

Comments
 (0)