Skip to content

Commit

Permalink
Rollup merge of #113385 - joshtriplett:style-guide-cleanup-chains, r=…
Browse files Browse the repository at this point in the history
…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+.
  • Loading branch information
workingjubilee authored Jul 12, 2023
2 parents dff0725 + 24534cf commit 3518041
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/doc/style-guide/src/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,11 @@ foo(

#### Multi-line elements

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

```rust
a.b.c()?.d
a.b.c()?
.foo(
an_expr,
another_expr,
Expand Down

0 comments on commit 3518041

Please sign in to comment.