style-team: blocks
Simple blocks, { ... }.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (12 by maintainers)
Commits related to this issue
- Blocks closes #21 cc #89 — committed to rust-lang/style-team by nrc 7 years ago
- Blocks closes #21 cc #89 — committed to rust-lang/style-team by nrc 7 years ago
Empty blocks should be
{}, imo, like empty parens:Should we specify whether spaces are required surrounding the statement in a single line block? i.e.
{ foo() }instead of{foo()}? My vote is that they should be required.Not a big thing, but I’d actually argue that to be consistent you’d have a space between the set braces if you also have spaces in single-line blocks. E.g. if you have
unsafe { foo() }instead ofunsafe {foo()}then you should also have{ }instead of{}.It seems to me we have rough consensus and thus we are ready for a PR here.
@nrc so a block in expression position may be one-line, but one in statement position must not be? I like that, personally.