Skip to content

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

Merged
bors merged 1 commit into
rust-lang:masterfrom
matthiaskrgr:unnnec_filter_map
Nov 9, 2021
Merged

use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))#90652
bors merged 1 commit into
rust-lang:masterfrom
matthiaskrgr:unnnec_filter_map

Conversation

@matthiaskrgr

Copy link
Copy Markdown
Member

No description provided.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-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
matthiaskrgrforce-pushed the unnnec_filter_map branch 2 times, most recently from d2a9185 to ed7e438CompareNovember 6, 2021 16:58
Comment on lines 1373 to 1374
.iter()
.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
Copy Markdown
MemberAuthor

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
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Nov 7, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit ed7e438 has been approved by jyn514

@borsbors 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
@jyn514jyn514 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
returntrue;
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:masterNov 9, 2021
@rustbotrustbot added this to the 1.58.0 milestone Nov 9, 2021
@matthiaskrgr
matthiaskrgr deleted the unnnec_filter_map branch January 25, 2025 09:13
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cleanupCategory: PRs that clean code up or issues documenting cleanup.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@matthiaskrgr@rust-highfive@rust-log-analyzer@jyn514@bors@spastorino@jackh726@rustbot