Rollup merge of #80344 - matthiaskrgr:matches, r=Dylan-DPC
use matches!() macro in more places
This commit is contained in:
commit
c51172f38a
33 changed files with 137 additions and 266 deletions
|
@ -132,10 +132,7 @@ impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
|
|||
[segment]
|
||||
if segment
|
||||
.res
|
||||
.map(|res| match res {
|
||||
Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _) => true,
|
||||
_ => false,
|
||||
})
|
||||
.map(|res| matches!(res, Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _)))
|
||||
.unwrap_or(false) =>
|
||||
{
|
||||
self.types.push(path.span);
|
||||
|
|
|
@ -93,10 +93,7 @@ impl<'tcx> FreeRegionMap<'tcx> {
|
|||
|
||||
/// True for free regions other than `'static`.
|
||||
pub fn is_free(&self, r: Region<'_>) -> bool {
|
||||
match *r {
|
||||
ty::ReEarlyBound(_) | ty::ReFree(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(r, ty::ReEarlyBound(_) | ty::ReFree(_))
|
||||
}
|
||||
|
||||
/// True if `r` is a free region or static of the sort that this
|
||||
|
|
|
@ -393,10 +393,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
if self.expand_node(a_region, b_vid, b_data) {
|
||||
changes.push(b_vid);
|
||||
}
|
||||
match *b_data {
|
||||
VarValue::Value(ReStatic) | VarValue::ErrorValue => false,
|
||||
_ => true,
|
||||
}
|
||||
!matches!(b_data, VarValue::Value(ReStatic) | VarValue::ErrorValue)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -972,11 +969,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
}
|
||||
|
||||
VerifyBound::IsEmpty => {
|
||||
if let ty::ReEmpty(_) = min {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
matches!(min, ty::ReEmpty(_))
|
||||
}
|
||||
|
||||
VerifyBound::AnyBound(bs) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue