Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove semicolon after break/continue/return by default? #993

Closed
alexcrichton opened this issue May 17, 2016 · 1 comment
Closed

Remove semicolon after break/continue/return by default? #993

alexcrichton opened this issue May 17, 2016 · 1 comment

Comments

@alexcrichton
Copy link
Member

Right now it looks like rustfmt always inserts a semicolon after break, return, and continue expressions. Given that it is semantically invalid to include code after these expressions, why not make it syntactically invalid as well? That is, the only typical need for inserting a semicolon is to change some type to () or to allow writing another statement, but in the case of these expressions there's no need to do either (and you save a character to boot).

Maybe this is better waiting for the RFC process, though?

@nrc
Copy link
Member

nrc commented May 17, 2016

Yeah, this should go through the RFC process. I'll leave the issue open since we should make this a config option.

I prefer semicolons after these expressions since I think it is consistent to have return x; and return; (or even return ();), but this is pretty subjective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants