Skip to content

Commit d3c475f

Browse files
committed
Clarify a point around match arms
cc rust-lang/rustfmt#3005
1 parent 98e2c61 commit d3c475f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

guide/expressions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,19 @@ clause, then you must use the above form:
738738
}
739739
```
740740

741+
If the pattern is multi-line, and the last line is less wide than the indent, do
742+
not put the `if` clause on a newline. E.g.,
743+
744+
```rust
745+
Token::Dimension {
746+
value,
747+
ref unit,
748+
..
749+
} if num_context.is_ok(context.parsing_mode, value) => {
750+
...
751+
}
752+
```
753+
741754
If every clause in a pattern is *small*, but does not fit on one line, then the
742755
pattern may be formatted across multiple lines with as many clauses per line as
743756
possible. Again break before a `|`:

0 commit comments

Comments
 (0)