Skip to content

libsyntax: improve error message when a statement is prefixed with a match keyword #29441

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 1 commit into from
Oct 29, 2015

Conversation

Ryman
Copy link
Contributor

@Ryman Ryman commented Oct 28, 2015

This helps for the case where a match, such as below:

let foo = match foo {
    Some(x) => x,
    None => 0
};

gets refactored to no longer need the match, but the match keyword has been left accidentally:

let foo = match foo.unwrap_or(0);

This can be hard to spot as the expression grows more complex.

r? @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+ 99ecf4e

Neat!

@bors
Copy link
Collaborator

bors commented Oct 29, 2015

⌛ Testing commit 99ecf4e with merge 2af9aab...

bors added a commit that referenced this pull request Oct 29, 2015
This helps for the case where a match, such as below:
```rust
let foo = match foo {
    Some(x) => x,
    None => 0
};
```
gets refactored to no longer need the match, but the match keyword has been left accidentally: 

```rust
let foo = match foo.unwrap_or(0);
```

This can be hard to spot as the expression grows more complex.

r? @alexcrichton
@bors bors merged commit 99ecf4e into rust-lang:master Oct 29, 2015
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.

3 participants