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

Change redundant_pattern_matching to also lint std::task::Poll #6339

Merged
merged 1 commit into from
Nov 24, 2020

Conversation

CDirkx
Copy link
Contributor

@CDirkx CDirkx commented Nov 17, 2020

reduntant_pattern_matching currently lints pattern matching on Option and Result where the is_variant utility methods could be used instead: is_some, is_none, is_ok, is_err. This PR extends this behaviour to std::task::Poll, suggesting the methods is_pending and is_ready.

Motivation: The current description of redundant_pattern_matching mentions

It's more concise and clear to just use the proper utility function

which in my mind applies to Poll as well.

changelog: Enhance [redundant_pattern_matching] to also lint on std::task::Poll

@rust-highfive
Copy link

r? @ebroto

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 17, 2020
@CDirkx CDirkx force-pushed the redundant-pattern-match-poll branch 2 times, most recently from 6d96043 to e39c3fe Compare November 17, 2020 22:25
Suggest using utility methods `is_pending` and `is_ready`.
@CDirkx CDirkx force-pushed the redundant-pattern-match-poll branch from e39c3fe to 5a83968 Compare November 17, 2020 22:43
@ebroto
Copy link
Member

ebroto commented Nov 24, 2020

@bors r+

Thanks! (and sorry for the delay in reviewing, I did not have much free time lately)

@bors
Copy link
Collaborator

bors commented Nov 24, 2020

📌 Commit 5a83968 has been approved by ebroto

bors added a commit that referenced this pull request Nov 24, 2020
Change `redundant_pattern_matching` to also lint `std::task::Poll`

`reduntant_pattern_matching` currently lints pattern matching on `Option` and `Result` where the `is_variant` utility methods could be used instead: `is_some`, `is_none`, `is_ok`, `is_err`. This PR extends this behaviour to `std::task::Poll`, suggesting the methods `is_pending` and `is_ready`.

Motivation: The current description of `redundant_pattern_matching` mentions

> It's more concise and clear to just use the proper utility function

which in my mind applies to `Poll` as well.
@bors
Copy link
Collaborator

bors commented Nov 24, 2020

⌛ Testing commit 5a83968 with merge 3d78270...

@bors
Copy link
Collaborator

bors commented Nov 24, 2020

💔 Test failed - checks-action_test

@ebroto ebroto removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 24, 2020
@ebroto
Copy link
Member

ebroto commented Nov 24, 2020

@bors retry (changelog)

@bors
Copy link
Collaborator

bors commented Nov 24, 2020

⌛ Testing commit 5a83968 with merge f897d27...

@CDirkx
Copy link
Contributor Author

CDirkx commented Nov 24, 2020

If you agree with the similar reasoning I can create a PR to also add IpAddr::is_ipv4 and is_ipv6

@ebroto
Copy link
Member

ebroto commented Nov 24, 2020

Yep, sounds good to me!

@bors
Copy link
Collaborator

bors commented Nov 24, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: ebroto
Pushing f897d27 to master...

@bors bors merged commit f897d27 into rust-lang:master Nov 24, 2020
@CDirkx CDirkx deleted the redundant-pattern-match-poll branch November 24, 2020 23:47
bors added a commit that referenced this pull request Nov 28, 2020
Enhance `redundant_pattern_matching` to also lint on `std::net::IpAddr`

Follow-up to #6339
r? `@ebroto`

(note: also contains a small cleanup of the other ui tests)

changelog: Enhance [`redundant_pattern_matching`] to also lint on `std::net::IpAddr`
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.

4 participants