Enable unused_parens for match arms
This commit is contained in:
parent
c9e134e1b6
commit
8dd44f1af4
6 changed files with 58 additions and 3 deletions
|
@ -396,6 +396,7 @@ enum UnusedDelimsCtx {
|
|||
LetScrutineeExpr,
|
||||
ArrayLenExpr,
|
||||
AnonConst,
|
||||
MatchArmExpr,
|
||||
}
|
||||
|
||||
impl From<UnusedDelimsCtx> for &'static str {
|
||||
|
@ -414,6 +415,7 @@ impl From<UnusedDelimsCtx> for &'static str {
|
|||
UnusedDelimsCtx::BlockRetValue => "block return value",
|
||||
UnusedDelimsCtx::LetScrutineeExpr => "`let` scrutinee expression",
|
||||
UnusedDelimsCtx::ArrayLenExpr | UnusedDelimsCtx::AnonConst => "const expression",
|
||||
UnusedDelimsCtx::MatchArmExpr => "match arm expression",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -805,6 +807,18 @@ impl EarlyLintPass for UnusedParens {
|
|||
}
|
||||
return;
|
||||
}
|
||||
ExprKind::Match(ref _expr, ref arm) => {
|
||||
for a in arm {
|
||||
self.check_unused_delims_expr(
|
||||
cx,
|
||||
&a.body,
|
||||
UnusedDelimsCtx::MatchArmExpr,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue