Skip to content

Commit 45b2559

Browse files
docs(style-guide): don't flatten match arms with macro call
1 parent 500647f commit 45b2559

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/doc/style-guide/src/expressions.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,8 @@ never use a block (unless the block is empty).
663663

664664
If the right-hand side consists of multiple statements, or has line comments,
665665
or the start of the line does not fit on the same line as the left-hand side,
666-
use a block.
666+
use a block. Do not flatten a right-hand side block containing a single macro call
667+
because its expanded form could contain a trailing semicolon.
667668

668669
Block-indent the body of a block arm.
669670

@@ -686,6 +687,10 @@ match foo {
686687
bar => {}
687688
// Trailing comma on last item.
688689
foo => bar,
690+
baz => qux!(),
691+
lorem => {
692+
ipsum!()
693+
}
689694
}
690695
```
691696

0 commit comments

Comments
 (0)