We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
|
1 parent 5c5c00d commit 126715eCopy full SHA for 126715e
guide/expressions.md
@@ -499,6 +499,22 @@ let x = match foo.bar.baz() {
499
500
Use a trailing comma for a match arm if and only if not using a block.
501
502
+Never start a match arm pattern with `|`, e.g.,
503
+
504
+```rust
505
+match foo {
506
+ // Don't do this.
507
+ | foo => bar,
508
+ // Or this.
509
+ | a_very_long_pattern
510
+ | another_pattern
511
+ | yet_another_pattern
512
+ | a_forth_pattern => {
513
+ ...
514
+ }
515
+}
516
+```
517
518
Avoid splitting the left-hand side (before the `=>`) of a match arm where
519
possible. If the right-hand side of the match arm is kept on the same line,
520
never use a block (unless the block is empty).
0 commit comments