Skip to content

Commit 3518041

Browse files
Rollup merge of #113385 - joshtriplett:style-guide-cleanup-chains, r=calebcartwright
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. This is a bugfix to match rustfmt behavior, so it's not a breaking change, and it just needs a ``@rust-lang/style`` reviewer to r+.
2 parents dff0725 + 24534cf commit 3518041

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
@@ -451,12 +451,11 @@ foo(
451451

452452
#### Multi-line elements
453453

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

458457
```rust
459-
a.b.c()?.d
458+
a.b.c()?
460459
.foo(
461460
an_expr,
462461
another_expr,

0 commit comments

Comments
 (0)