use matches!() macro in more places

This commit is contained in:
Matthias Krüger
2021-11-06 01:31:32 +01:00
parent 3cd3bbecc5
commit 0a5640b55f
21 changed files with 49 additions and 86 deletions

View File

@@ -131,10 +131,7 @@ impl Qualifs<'mir, 'tcx> {
.body
.basic_blocks()
.iter_enumerated()
.find(|(_, block)| match block.terminator().kind {
TerminatorKind::Return => true,
_ => false,
})
.find(|(_, block)| matches!(block.terminator().kind, TerminatorKind::Return))
.map(|(bb, _)| bb);
let return_block = match return_block {

View File

@@ -170,11 +170,12 @@ impl Qualif for NeedsNonConstDrop {
let mut selcx = SelectionContext::with_constness(&infcx, hir::Constness::Const);
selcx.select(&obligation)
});
match implsrc {
Ok(Some(ImplSource::ConstDrop(_)))
| Ok(Some(ImplSource::Param(_, ty::BoundConstness::ConstIfConst))) => false,
_ => true,
}
!matches!(
implsrc,
Ok(Some(
ImplSource::ConstDrop(_) | ImplSource::Param(_, ty::BoundConstness::ConstIfConst)
))
)
}
fn in_adt_inherently(cx: &ConstCx<'_, 'tcx>, adt: &'tcx AdtDef, _: SubstsRef<'tcx>) -> bool {