use matches! macro in more places
This commit is contained in:
parent
e6e956dade
commit
bcc15bba95
13 changed files with 52 additions and 75 deletions
|
@ -312,13 +312,10 @@ pub fn suggest_new_region_bound(
|
|||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
} else if opaque.bounds.iter().any(|arg| match arg {
|
||||
GenericBound::Outlives(Lifetime { ident, .. })
|
||||
if ident.name.to_string() == lifetime_name =>
|
||||
{
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
} else if opaque.bounds.iter().any(|arg| {
|
||||
matches!(arg,
|
||||
GenericBound::Outlives(Lifetime { ident, .. })
|
||||
if ident.name.to_string() == lifetime_name )
|
||||
}) {
|
||||
} else {
|
||||
// get a lifetime name of existing named lifetimes if any
|
||||
|
|
|
@ -1577,10 +1577,10 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
(TyOrConstInferVar::Ty(ty_var), Ok(inner)) => {
|
||||
use self::type_variable::TypeVariableValue;
|
||||
|
||||
match inner.try_type_variables_probe_ref(ty_var) {
|
||||
Some(TypeVariableValue::Unknown { .. }) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(
|
||||
inner.try_type_variables_probe_ref(ty_var),
|
||||
Some(TypeVariableValue::Unknown { .. })
|
||||
)
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
|
|
|
@ -89,10 +89,10 @@ impl<'tcx> PredicateObligation<'tcx> {
|
|||
impl<'tcx> TraitObligation<'tcx> {
|
||||
/// Returns `true` if the trait predicate is considered `const` in its ParamEnv.
|
||||
pub fn is_const(&self) -> bool {
|
||||
match (self.predicate.skip_binder().constness, self.param_env.constness()) {
|
||||
(ty::BoundConstness::ConstIfConst, hir::Constness::Const) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(
|
||||
(self.predicate.skip_binder().constness, self.param_env.constness()),
|
||||
(ty::BoundConstness::ConstIfConst, hir::Constness::Const)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn derived_cause(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue