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

Most upvoted comments

Empty blocks should be {}, imo, like empty parens:

fn foo() {}

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.

Empty blocks should be {}, imo, like empty parens

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 of unsafe {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.