1
Fork 0

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

@ -436,11 +436,8 @@ impl<'a, 'tcx> CastCheck<'tcx> {
// Very crude check to see whether the expression must be wrapped
// in parentheses for the suggestion to work (issue #89497).
// Can/should be extended in the future.
let needs_parens = !has_parens
&& match self.expr.kind {
hir::ExprKind::Cast(..) => true,
_ => false,
};
let needs_parens =
!has_parens && matches!(self.expr.kind, hir::ExprKind::Cast(..));
let mut suggestion = vec![(self.expr.span.shrink_to_lo(), sugg)];
if needs_parens {

View file

@ -300,7 +300,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
hir::TyKind::Path(hir::QPath::Resolved(
None,
hir::Path { res: hir::def::Res::Def(_, id), .. },
)) if *id == def_id => true,
)) => *id == def_id,
_ => false,
})
})