Suggest if let in more cases#17067
Open
koenw wants to merge 2 commits into
Open
Conversation
Given the following Clippy currently doesn't trigger a `single_match` lint:
```rust
match x {
Ok(_) => {},
Err(a) => { do_something(a) },
}
```
whereas Clippy *does* trigger a `single_match` lint if the arms are switched around:
```rust
match x {
Err(a) => { do_something(a) },
Ok(_) => {},
}
```
This commit updates the `single_match` lint to trigger in both cases.
Collaborator
|
rustbot has assigned @samueltardieu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Lintcheck changes for dc5d818
This comment will be updated if you push new changes |
Author
|
So stupidly I forgot to run the tests without |
This commit updates the `infinite_loops` and `ref_patterns` tests to not trigger the newly updated `single_match` lint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Given the following Clippy currently doesn't trigger a
single_matchlint:whereas Clippy does trigger a
single_matchlint if the arms are switched around:This commit updates the
single_matchlint to trigger in both cases.changelog: [
single_match]: Suggestif letin more casesPossibly fixes #2567 (If I understand the issue correctly).