1
Fork 0

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

@ -971,7 +971,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
// have no `rustc_const_stable` attributes to be const-unstable as well. This
// should be fixed later.
let callee_is_unstable_unmarked = tcx.lookup_const_stability(callee).is_none()
&& tcx.lookup_stability(callee).map_or(false, |s| s.is_unstable());
&& tcx.lookup_stability(callee).is_some_and(|s| s.is_unstable());
if callee_is_unstable_unmarked {
trace!("callee_is_unstable_unmarked");
// We do not use `const` modifiers for intrinsic "functions", as intrinsics are

View file

@ -139,5 +139,5 @@ fn is_parent_const_stable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
return false;
}
tcx.lookup_const_stability(parent.owner).map_or(false, |stab| stab.is_const_stable())
tcx.lookup_const_stability(parent.owner).is_some_and(|stab| stab.is_const_stable())
}