Use Option::is_some_and
and Result::is_ok_and
in the compiler
This commit is contained in:
parent
70db836922
commit
fb0f74a8c9
87 changed files with 148 additions and 158 deletions
|
@ -780,7 +780,7 @@ impl SyntaxExtension {
|
|||
let allow_internal_unsafe = attr::contains_name(attrs, sym::allow_internal_unsafe);
|
||||
let local_inner_macros = attr::find_by_name(attrs, sym::macro_export)
|
||||
.and_then(|macro_export| macro_export.meta_item_list())
|
||||
.map_or(false, |l| attr::list_contains_name(&l, sym::local_inner_macros));
|
||||
.is_some_and(|l| attr::list_contains_name(&l, sym::local_inner_macros));
|
||||
let collapse_debuginfo = attr::contains_name(attrs, sym::collapse_debuginfo);
|
||||
tracing::debug!(?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe);
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool {
|
|||
&& version
|
||||
.next()
|
||||
.and_then(|c| c.parse::<u32>().ok())
|
||||
.map_or(false, |v| v < 6)
|
||||
.is_some_and(|v| v < 6)
|
||||
};
|
||||
|
||||
if crate_matches {
|
||||
|
|
|
@ -1599,7 +1599,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
|||
cfg_pos = Some(pos); // a cfg attr found, no need to search anymore
|
||||
break;
|
||||
} else if attr_pos.is_none()
|
||||
&& !name.map_or(false, rustc_feature::is_builtin_attr_name)
|
||||
&& !name.is_some_and(rustc_feature::is_builtin_attr_name)
|
||||
{
|
||||
attr_pos = Some(pos); // a non-cfg attr found, still may find a cfg attr
|
||||
}
|
||||
|
@ -1647,7 +1647,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
|||
let current_span = if let Some(sp) = span { sp.to(attr.span) } else { attr.span };
|
||||
span = Some(current_span);
|
||||
|
||||
if attrs.peek().map_or(false, |next_attr| next_attr.doc_str().is_some()) {
|
||||
if attrs.peek().is_some_and(|next_attr| next_attr.doc_str().is_some()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1950,6 +1950,6 @@ impl<'feat> ExpansionConfig<'feat> {
|
|||
}
|
||||
|
||||
fn proc_macro_hygiene(&self) -> bool {
|
||||
self.features.map_or(false, |features| features.proc_macro_hygiene)
|
||||
self.features.is_some_and(|features| features.proc_macro_hygiene)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue