-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
compiler/rustc_attr/src/builtin.rs
Outdated
@@ -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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Thanks! (keep up the great work on the Perf Summit :) @bors r+ rollup |
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! |
…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
It's slightly shorter and better communicates the intent.