X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_utils%2Fsrc%2Fhir_utils.rs;h=7438b6eabf9e61f267670b1c3df24b4018414ebd;hb=57dc0343bdd05ed13aa2704ca6a873843143f5a9;hp=fd70553e064b6385b35b685cbc2a0c107ef23953;hpb=0af50b4d320750fb2b756e2b556237877e097872;p=rust.git diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs index fd70553e064..7438b6eabf9 100644 --- a/clippy_utils/src/hir_utils.rs +++ b/clippy_utils/src/hir_utils.rs @@ -232,6 +232,7 @@ 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(lp, le, _), &ExprKind::Let(rp, 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) @@ -539,7 +540,7 @@ pub fn hash_block(&mut self, b: &Block<'_>) { std::mem::discriminant(&b.rules).hash(&mut self.s); } - #[allow(clippy::many_single_char_names, clippy::too_many_lines)] + #[allow(clippy::too_many_lines)] pub fn hash_expr(&mut self, e: &Expr<'_>) { let simple_const = self .maybe_typeck_results @@ -665,6 +666,10 @@ pub fn hash_expr(&mut self, e: &Expr<'_>) { } } }, + ExprKind::Let(pat, expr, _) => { + self.hash_expr(expr); + self.hash_pat(pat); + }, ExprKind::LlvmInlineAsm(..) | ExprKind::Err => {}, ExprKind::Lit(ref l) => { l.node.hash(&mut self.s);