]> git.lizzy.rs Git - rust.git/blobdiff - clippy_utils/src/hir_utils.rs
Rollup merge of #88230 - steffahn:a_an, r=oli-obk
[rust.git] / clippy_utils / src / hir_utils.rs
index fd70553e064b6385b35b685cbc2a0c107ef23953..a44f2df2fd631e9793dd022cc50517a48caa7e07 100644 (file)
@@ -232,6 +232,9 @@ pub fn eq_expr(&mut self, left: &Expr<'_>, right: &Expr<'_>) -> bool {
             (&ExprKind::If(lc, lt, ref le), &ExprKind::If(rc, rt, ref re)) => {
                 self.eq_expr(lc, rc) && self.eq_expr(&**lt, &**rt) && both(le, re, |l, r| self.eq_expr(l, r))
             },
+            (&ExprKind::Let(ref lp, ref le, _), &ExprKind::Let(ref rp, ref re, _)) => {
+                self.eq_pat(lp, rp) && self.eq_expr(le, re)
+            },
             (&ExprKind::Lit(ref l), &ExprKind::Lit(ref r)) => l.node == r.node,
             (&ExprKind::Loop(lb, ref ll, ref lls, _), &ExprKind::Loop(rb, ref rl, ref rls, _)) => {
                 lls == rls && self.eq_block(lb, rb) && both(ll, rl, |l, r| l.ident.name == r.ident.name)
@@ -665,6 +668,10 @@ pub fn hash_expr(&mut self, e: &Expr<'_>) {
                     }
                 }
             },
+            ExprKind::Let(ref pat, ref expr, _) => {
+                self.hash_expr(expr);
+                self.hash_pat(pat);
+            },
             ExprKind::LlvmInlineAsm(..) | ExprKind::Err => {},
             ExprKind::Lit(ref l) => {
                 l.node.hash(&mut self.s);