1
Fork 0

Clarify guide for unbraced closures: grammatical consistency

This commit is contained in:
Josh Triplett 2020-08-28 16:44:34 -07:00
parent 2fc1de3c96
commit 9539af86c3

View file

@ -125,9 +125,9 @@ expression of the closure. Between the `|`s, use function definition syntax,
but elide types where possible. but elide types where possible.
Use closures without the enclosing `{}`, if possible. Add the `{}` when you have Use closures without the enclosing `{}`, if possible. Add the `{}` when you have
a return type, when there are statements, there are comments in the body, or the a return type, when there are statements, when there are comments in the body,
body expression spans multiple lines and is a control-flow expression. If using or when the body expression spans multiple lines and is a control-flow
braces, follow the rules above for blocks. Examples: expression. If using braces, follow the rules above for blocks. Examples:
```rust ```rust
|arg1, arg2| expr |arg1, arg2| expr