Skip to content

Use an explicit flag to decide on whether to add brace compensation for block expression #2209

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

Merged
merged 5 commits into from
Nov 29, 2017

Conversation

topecongiro
Copy link
Contributor

Closes #2207.

Copy link
Member

@nrc nrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good, just a small quibble about the name of the flag.

src/visitor.rs Outdated
&mut self,
b: &ast::Block,
inner_attrs: Option<&[ast::Attribute]>,
is_dummy: bool,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COuld we call is_dummy has_braces or something similar? It's not obvious to me what is_dummy means.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

is_dummy is true when we manually construct a block for the body of closure. Since the block is not present in the original code I called it dummy.
I agree that using has_braces is better, it is more natural to use a flag that is true most of the time and false in a narrow case. And the name is clearer.

@nrc nrc merged commit b8106eb into rust-lang:master Nov 29, 2017
@nrc
Copy link
Member

nrc commented Nov 29, 2017

Thanks!

@topecongiro topecongiro deleted the issue-2207 branch November 30, 2017 00:57
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

Successfully merging this pull request may close these issues.

2 participants