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

[rustc_attr][nit] Replace filter + is_some with map_or. #114340

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

ttsugriy
Copy link
Contributor

@ttsugriy ttsugriy commented Aug 1, 2023

It's slightly shorter and better communicates the intent.

@rustbot
Copy link
Collaborator

rustbot commented Aug 1, 2023

r? @b-naber

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 1, 2023
@@ -28,7 +28,7 @@ pub fn rust_version_symbol() -> Symbol {
}

pub fn is_builtin_attr(attr: &Attribute) -> bool {
attr.is_doc_comment() || attr.ident().filter(|ident| is_builtin_attr_name(ident.name)).is_some()
attr.is_doc_comment() || attr.ident().map_or(false, |ident| is_builtin_attr_name(ident.name))
Copy link
Member

Choose a reason for hiding this comment

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

Option::is_some_and seems clearer and communicates the intent better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed! Thanks for the great suggestion!

It's slightly shorter and better communicates the intent.
@lqd
Copy link
Member

lqd commented Aug 1, 2023

Thanks!

(keep up the great work on the Perf Summit :)

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 1, 2023

📌 Commit 9563eec has been approved by lqd

It is now in the queue for this repository.

@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 Aug 1, 2023
@ttsugriy
Copy link
Contributor Author

ttsugriy commented Aug 1, 2023

Thank you so much for the kind words and your thoughtful code review, @lqd! People like you, who make Rust community super welcoming and helpful are the real heroes!

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 2, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#114178 (Account for macros when suggesting a new let binding)
 - rust-lang#114199 (Don't unsize coerce infer vars in select in new solver)
 - rust-lang#114301 (Don't check unnecessarily that impl trait is RPIT)
 - rust-lang#114314 (Tweaks to `adt_sized_constraint`)
 - rust-lang#114322 (Fix invalid slice coercion suggestion reported in turbofish)
 - rust-lang#114340 ([rustc_attr][nit] Replace `filter` + `is_some` with `map_or`.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4876afb into rust-lang:master Aug 2, 2023
@rustbot rustbot added this to the 1.73.0 milestone Aug 2, 2023
@ttsugriy ttsugriy deleted the rustc-attr branch August 2, 2023 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants