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 except in suspicious_else_formatting #3960

Merged
merged 3 commits into from
Apr 14, 2019
Merged

Conversation

phansch
Copy link
Member

@phansch phansch commented Apr 14, 2019

96c34e8 contains the fix:

This was causing two different ICEs in #3741. The first was fixed in #3925.

The second one is fixed with this commit: We just don't expect anymore.
If the snippet doesn't contain an else, we stop emitting the lint because
it's not a suspiciously formatted else anyway.

Unfortunately I wasn't able to provide a minimal test case, but I think it's
fine since it's just ignoring the None case now.

And ad27e3f cleans up the lint code to use if_chain.

Fixes #3741 once more.

This was causing two different ICEs in rust-lang#3741.
The first was fixed in rust-lang#3925.

The second one is fixed with this commit: We just don't `expect`
anymore. If the snippet doesn't contain an `else`, we stop emitting the
lint because it's not a suspiciously formatted else anyway.
@phansch phansch added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 14, 2019
@phansch phansch closed this Apr 14, 2019
@phansch phansch reopened this Apr 14, 2019
let else_pos = else_snippet.find("else").expect("there must be a `else` here");
// this will be a span from the closing ‘}’ of the “then” block (excluding) to
// the
// “if” of the “else if” block (excluding)
Copy link
Member

Choose a reason for hiding this comment

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

NIT: formatting

Is it possible to add a test for this ICE? Otherwise r=me with formatting fixed.

Copy link
Member Author

Choose a reason for hiding this comment

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

nit fixed =)

I tried since yesterday but couldn't come up with a test case without external dependencies on relm and gtk. I think it's fine to merge it in this case since the ICE was triggered by an explicit expect in our code and it would only regress if we were to add it back.

@flip1995
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 14, 2019

📌 Commit 289a9af has been approved by flip1995

@bors
Copy link
Collaborator

bors commented Apr 14, 2019

⌛ Testing commit 289a9af with merge 6505794...

bors added a commit that referenced this pull request Apr 14, 2019
Remove `except` in suspicious_else_formatting

96c34e8 contains the fix:

This was causing two different ICEs in #3741. The first was fixed in #3925.

The second one is fixed with this commit: We just don't `expect` anymore.
If the snippet doesn't contain an `else`, we stop emitting the lint because
it's not a suspiciously formatted else anyway.

Unfortunately I wasn't able to provide a minimal test case, but I think it's
fine since it's just ignoring the `None` case now.

And ad27e3f cleans up the lint code to use `if_chain`.

Fixes #3741 once more.
@hcpl
Copy link

hcpl commented Apr 14, 2019

Just a small nit, but the PR and the branch name use "except" instead of "expect". 😆

@bors
Copy link
Collaborator

bors commented Apr 14, 2019

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

@bors bors merged commit 289a9af into rust-lang:master Apr 14, 2019
@phansch phansch deleted the fix_except branch April 18, 2019 05:20
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.

Panic on relm macro with "there must be a else here" message
4 participants