Fix missing unused_variables lint when using a match guard
Within a binding pattern match guard, only real reads of a bound local impact its liveness analysis - not the fake read that is injected.
This commit is contained in:
parent
cdee2fbff5
commit
267f40dbb4
1 changed files with 1 additions and 1 deletions
|
|
@ -85,7 +85,7 @@ impl LateLintPass<'_> for UncheckedTimeSubtraction {
|
|||
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) {
|
||||
let (lhs, rhs) = match expr.kind {
|
||||
ExprKind::Binary(op, lhs, rhs) if matches!(op.node, BinOpKind::Sub,) => (lhs, rhs),
|
||||
ExprKind::MethodCall(fn_name, lhs, [rhs], _) if cx.ty_based_def(expr).is_diag_item(cx, sym::sub) => {
|
||||
ExprKind::MethodCall(_, lhs, [rhs], _) if cx.ty_based_def(expr).is_diag_item(cx, sym::sub) => {
|
||||
(lhs, rhs)
|
||||
},
|
||||
_ => return,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue