Parse a pattern with no arm
This commit is contained in:
parent
caa488b96e
commit
80bdcbf50a
36 changed files with 420 additions and 279 deletions
|
@ -1000,8 +1000,10 @@ impl EarlyLintPass for UnusedDocComment {
|
|||
}
|
||||
|
||||
fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) {
|
||||
let arm_span = arm.pat.span.with_hi(arm.body.span.hi());
|
||||
warn_if_doc(cx, arm_span, "match arms", &arm.attrs);
|
||||
if let Some(body) = &arm.body {
|
||||
let arm_span = arm.pat.span.with_hi(body.span.hi());
|
||||
warn_if_doc(cx, arm_span, "match arms", &arm.attrs);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &ast::Pat) {
|
||||
|
|
|
@ -1113,15 +1113,17 @@ impl EarlyLintPass for UnusedParens {
|
|||
}
|
||||
ExprKind::Match(ref _expr, ref arm) => {
|
||||
for a in arm {
|
||||
self.check_unused_delims_expr(
|
||||
cx,
|
||||
&a.body,
|
||||
UnusedDelimsCtx::MatchArmExpr,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
);
|
||||
if let Some(body) = &a.body {
|
||||
self.check_unused_delims_expr(
|
||||
cx,
|
||||
body,
|
||||
UnusedDelimsCtx::MatchArmExpr,
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue