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

Replace unsugar_if function with is_if function #4230

Merged
merged 2 commits into from
Jun 24, 2019

Conversation

flip1995
Copy link
Member

cc #4123 (comment)

changelog: none

r? @Manishearth

@flip1995 flip1995 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 24, 2019
@Manishearth
Copy link
Member

We should just remove it -- it was useful when if and if let used different ASTs, but it's not anymore, you can just match on the if.

if let Some((then, &Some(ref else_))) = unsugar_if(expr);
if is_block(else_) || unsugar_if(else_).is_some();
if let ExprKind::If(_, then, Some(else_)) = &expr.node;
if is_block(else_) || is_if(else_);
Copy link
Member Author

Choose a reason for hiding this comment

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

There are multiple occurences of this function in a || or && expression. Removing this function would make the code way more complicated IMO

Copy link
Member

Choose a reason for hiding this comment

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

ah

@Manishearth
Copy link
Member

@bors r+

fair enough!

@bors
Copy link
Collaborator

bors commented Jun 24, 2019

📌 Commit 662037b has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Jun 24, 2019

⌛ Testing commit 662037b with merge f0edfab...

bors added a commit that referenced this pull request Jun 24, 2019
Replace `unsugar_if` function with `is_if` function

cc #4123 (comment)

changelog: none

r? @Manishearth
@bors
Copy link
Collaborator

bors commented Jun 24, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Manishearth
Pushing f0edfab to master...

@bors bors merged commit 662037b into rust-lang:master Jun 24, 2019
@flip1995 flip1995 deleted the unsugar_if branch June 26, 2019 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants