Skip to content

Commit c923196

Browse files
Merge pull request #158 from joshtriplett/clarifications
Clarifications on unbraced closures
2 parents 7416e12 + 71e61ff commit c923196

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

guide/expressions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ An empty block should be written as `{}`.
6161
A block may be written on a single line if:
6262

6363
* it is either used in expression position (not statement position) or is an
64-
unsafe block in statement position
65-
* contains a single-line expression and no statements
66-
* contains no comments
64+
unsafe block in statement position,
65+
* it contains a single-line expression and no statements, and
66+
* it contains no comments
6767

6868
A single line block should have spaces after the opening brace and before the
6969
closing brace.
@@ -122,9 +122,9 @@ closure. Between the `|`s, you should use function definition syntax, however,
122122
elide types where possible.
123123

124124
Use closures without the enclosing `{}`, if possible. Add the `{}` when you have
125-
a return type, when there are statements, there are comments in the body, or the
126-
body expression spans multiple lines and is a control-flow expression. If using
127-
braces, follow the rules above for blocks. Examples:
125+
a return type, when there are statements, when there are comments inside the
126+
closure, or when the body expression is a control-flow expression that spans
127+
multiple lines. If using braces, follow the rules above for blocks. Examples:
128128

129129
```rust
130130
|arg1, arg2| expr

0 commit comments

Comments
 (0)