Use Option::is_some_and and Result::is_ok_and in the compiler

This commit is contained in:
Maybe Waffle 2023-05-24 14:19:22 +00:00
parent 70db836922
commit fb0f74a8c9
87 changed files with 148 additions and 158 deletions

View file

@ -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)
}
}