Skip to content

Commit 6d84065

Browse files
author
Gernot Ohner
committed
Add branches in eq_expr
1 parent 67d379b commit 6d84065

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clippy_utils/src/hir_utils.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,11 @@ impl HirEqInterExpr<'_, '_, '_> {
292292
(&ExprKind::Call(l_fun, l_args), &ExprKind::Call(r_fun, r_args)) => {
293293
self.inner.allow_side_effects && self.eq_expr(l_fun, r_fun) && self.eq_exprs(l_args, r_args)
294294
},
295-
(&ExprKind::Cast(lx, lt), &ExprKind::Cast(rx, rt)) | (&ExprKind::Type(lx, lt), &ExprKind::Type(rx, rt)) => {
295+
(&ExprKind::Cast(lx, lt), &ExprKind::Cast(rx, rt)) => {
296296
self.eq_expr(lx, rx) && self.eq_ty(lt, rt)
297297
},
298+
(&ExprKind::Closure(_l), &ExprKind::Closure(_r)) => false,
299+
(&ExprKind::ConstBlock(lb), &ExprKind::ConstBlock(rb)) => self.eq_body(lb.body, rb.body),
298300
(&ExprKind::Continue(li), &ExprKind::Continue(ri)) => {
299301
both(&li.label, &ri.label, |l, r| l.ident.name == r.ident.name)
300302
},
@@ -345,7 +347,9 @@ impl HirEqInterExpr<'_, '_, '_> {
345347
&& over(lf, rf, |l, r| self.eq_expr_field(l, r))
346348
},
347349
(&ExprKind::Tup(l_tup), &ExprKind::Tup(r_tup)) => self.eq_exprs(l_tup, r_tup),
350+
(&ExprKind::Type(le, lt), &ExprKind::Type(re, rt)) => self.eq_expr(le, re) && self.eq_ty(lt, rt),
348351
(&ExprKind::Unary(l_op, le), &ExprKind::Unary(r_op, re)) => l_op == r_op && self.eq_expr(le, re),
352+
(&ExprKind::Yield(le, _), &ExprKind::Yield(re, _)) => return self.eq_expr(le, re),
349353
(
350354
// Else branches for branches above, grouped as per `match_same_arms`.
351355
| &ExprKind::AddrOf(..)

0 commit comments

Comments
 (0)