about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2023-07-05 15:33:21 -0700
committerJosh Triplett <josh@joshtriplett.org>2023-07-05 15:33:21 -0700
commit24534cffe60044965d3cd11d49e9b568c3dfa865 (patch)
treec60ebb1fd70d4eb38b22dd9fe9ed733c378c99f8
parent5dac6b320be868f898a3c753934eabc79ff2e406 (diff)
downloadrust-24534cffe60044965d3cd11d49e9b568c3dfa865.tar.gz
rust-24534cffe60044965d3cd11d49e9b568c3dfa865.zip
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.
-rw-r--r--src/doc/style-guide/src/expressions.md7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/doc/style-guide/src/expressions.md b/src/doc/style-guide/src/expressions.md
index f5e37b6c46f..fda3b8e8209 100644
--- a/src/doc/style-guide/src/expressions.md
+++ b/src/doc/style-guide/src/expressions.md
@@ -450,12 +450,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,