1
Fork 0

Reduce boilerplate with the matches! macro

Replaces simple bool `match`es of the form

    match $expr {
        $pattern => true
        _ => false
    }

and their inverse with invocations of the matches! macro.
This commit is contained in:
LingMan 2020-09-21 04:53:44 +02:00
parent 0f9f0b384a
commit a6ff925f8b
13 changed files with 140 additions and 269 deletions

View file

@ -183,10 +183,10 @@ impl<'tcx> InstanceDef<'tcx> {
ty::InstanceDef::DropGlue(_, Some(_)) => return false,
_ => return true,
};
match tcx.def_key(def_id).disambiguated_data.data {
DefPathData::Ctor | DefPathData::ClosureExpr => true,
_ => false,
}
matches!(
tcx.def_key(def_id).disambiguated_data.data,
DefPathData::Ctor | DefPathData::ClosureExpr
)
}
/// Returns `true` if the machine code for this instance is instantiated in