Skip to content

New lint: pats_with_wild_match_arm#4960

Merged
bors merged 7 commits into
rust-lang:masterfrom
ThibsG:patterns_with_wildcard_#4640
Jan 9, 2020
Merged

New lint: pats_with_wild_match_arm#4960
bors merged 7 commits into
rust-lang:masterfrom
ThibsG:patterns_with_wildcard_#4640

Conversation

@ThibsG

@ThibsG ThibsG commented Dec 26, 2019

Copy link
Copy Markdown
Contributor

Wildcard use with other pattern in same match arm.

The wildcard covers other(s) pattern(s) as it will match anyway.

changelog: add new lint when multiple patterns (including wildcard) are used in a match arm.

Fixes #4640.

Comment thread clippy_lints/src/matches.rs Outdated
Comment thread clippy_lints/src/matches.rs Outdated
Comment thread clippy_lints/src/matches.rs Outdated
@ghost

ghost commented Dec 27, 2019

Copy link
Copy Markdown

This is great but I think the name could be better. I would call it wildcard_pattern_alternative or something like that... 🤔

@JohnTitor

JohnTitor commented Dec 27, 2019

Copy link
Copy Markdown
Member

Could you include Fixes #4640 in the PR description so that we can close once this is merged?
And the changelog line is also needed.

@JohnTitor JohnTitor added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 27, 2019
@ThibsG

ThibsG commented Dec 27, 2019

Copy link
Copy Markdown
Contributor Author

@mikerite Yes I believe we could do better for the name. I will think about it

@flip1995 flip1995 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lint name suggestion: WILDCARD_IN_OR_PATTERNS

Comment thread clippy_lints/src/matches.rs Outdated
Comment thread tests/ui/wildcard_enum_match_arm.rs Outdated
@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Dec 28, 2019
@bors

bors commented Jan 4, 2020

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #4881) made this pull request unmergeable. Please resolve the merge conflicts.

@ThibsG ThibsG force-pushed the patterns_with_wildcard_#4640 branch from 8bea285 to ad16718 Compare January 5, 2020 14:07
@ThibsG ThibsG requested a review from flip1995 January 5, 2020 14:16
Comment thread clippy_lints/src/matches.rs Outdated
@ThibsG ThibsG force-pushed the patterns_with_wildcard_#4640 branch from 596f208 to 4ba1bc7 Compare January 7, 2020 17:54
@ThibsG ThibsG force-pushed the patterns_with_wildcard_#4640 branch from 4ba1bc7 to 0fa0df9 Compare January 7, 2020 18:11
@flip1995

flip1995 commented Jan 7, 2020

Copy link
Copy Markdown
Member

Thanks!

@bors r+

@bors

bors commented Jan 7, 2020

Copy link
Copy Markdown
Contributor

📌 Commit 0fa0df9 has been approved by flip1995

@bors

bors commented Jan 7, 2020

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0fa0df9 with merge 0ff62a5...

bors added a commit that referenced this pull request Jan 7, 2020
New lint: pats_with_wild_match_arm

Wildcard use with other pattern in same match arm.

The wildcard covers other(s) pattern(s) as it will match anyway.

Changelog: add new lint when multiple patterns (including wildcard) are used in a match arm.

Fixes #4640.
@bors

bors commented Jan 7, 2020

Copy link
Copy Markdown
Contributor

💔 Test failed - checks-travis

@ThibsG

ThibsG commented Jan 7, 2020

Copy link
Copy Markdown
Contributor Author

Sorry @bors, didn't know you prefer 'changelog' over 'Changelog' in PR description

@flip1995

flip1995 commented Jan 7, 2020

Copy link
Copy Markdown
Member

Not @bors' fault, I hacked this check into travis 😋

@bors retry

@ThibsG

ThibsG commented Jan 8, 2020

Copy link
Copy Markdown
Contributor Author

@flip1995 do I need to fix something else here ?

@flip1995

flip1995 commented Jan 9, 2020

Copy link
Copy Markdown
Member

@bors are you still there?

@bors

bors commented Jan 9, 2020

Copy link
Copy Markdown
Contributor

🍰 Activated

@flip1995

flip1995 commented Jan 9, 2020

Copy link
Copy Markdown
Member

Nope, bors just didn't trigger 🤔

@bors r+

@bors

bors commented Jan 9, 2020

Copy link
Copy Markdown
Contributor

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.

@bors

bors commented Jan 9, 2020

Copy link
Copy Markdown
Contributor

📌 Commit 0fa0df9 has been approved by flip1995

bors added a commit that referenced this pull request Jan 9, 2020
New lint: pats_with_wild_match_arm

Wildcard use with other pattern in same match arm.

The wildcard covers other(s) pattern(s) as it will match anyway.

changelog: add new lint when multiple patterns (including wildcard) are used in a match arm.

Fixes #4640.
@bors

bors commented Jan 9, 2020

Copy link
Copy Markdown
Contributor

⌛ Testing commit 0fa0df9 with merge ac795a6...

@bors

bors commented Jan 9, 2020

Copy link
Copy Markdown
Contributor

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

@bors bors merged commit 0fa0df9 into rust-lang:master Jan 9, 2020
@ThibsG ThibsG deleted the patterns_with_wildcard_#4640 branch January 9, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unneeded multiple pattern with wildcard

5 participants