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

use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy)) #90652

Merged
merged 1 commit into from
Nov 9, 2021

Conversation

matthiaskrgr
Copy link
Member

No description provided.

@rust-highfive
Copy link
Collaborator

r? @jackh726

(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 6, 2021
@rust-log-analyzer

This comment has been minimized.

@matthiaskrgr matthiaskrgr force-pushed the unnnec_filter_map branch 2 times, most recently from d2a9185 to ed7e438 Compare November 6, 2021 16:58
Comment on lines -1373 to 1374
.filter_map(|param| match param.kind {
GenericParamKind::Lifetime { .. } => Some(param),
_ => None,
.filter(|param| {
matches!(param.kind, GenericParamKind::Lifetime { .. })
})
.enumerate()
.map(|(late_bound_idx, param)| {
Copy link
Member Author

Choose a reason for hiding this comment

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

hrm, apparently rustfmt really prefers

.filter(|param| {
     matches!(param.kind, GenericParamKind::Lifetime { .. })
})

over

 .filter(|param| matches!(param.kind, GenericParamKind::Lifetime { .. }))

:/

@jyn514
Copy link
Member

jyn514 commented Nov 7, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 7, 2021

📌 Commit ed7e438 has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 7, 2021
@jyn514 jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 7, 2021
}
}

Some(field)
return true;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return true;
true

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 8, 2021
…yn514

use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 8, 2021
…yn514

use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 9, 2021
…laumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#90494 (ARMv6K Horizon OS panic change)
 - rust-lang#90652 (use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy)))
 - rust-lang#90657 (Fix bug with `#[doc]` string single-character last lines)
 - rust-lang#90689 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9318810 into rust-lang:master Nov 9, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants