diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2024-06-10 01:40:06 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2024-07-05 03:09:14 -0400 |
| commit | d1dcd918e72e62bbf81c01c1b4cebaf1d9a4eb6f (patch) | |
| tree | fea0b09bf844f963bc5d53c29a2ad821bb7a1133 | |
| parent | 441500b55b4529e8ba231c8b7165f8686f32e67c (diff) | |
| download | rust-d1dcd918e72e62bbf81c01c1b4cebaf1d9a4eb6f.tar.gz rust-d1dcd918e72e62bbf81c01c1b4cebaf1d9a4eb6f.zip | |
`equatable_if_let`: Check HIR tree before checking for macros.
| -rw-r--r-- | clippy_lints/src/equatable_if_let.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/equatable_if_let.rs b/clippy_lints/src/equatable_if_let.rs index 37442bf3e28..fb9f2b1526e 100644 --- a/clippy_lints/src/equatable_if_let.rs +++ b/clippy_lints/src/equatable_if_let.rs @@ -70,9 +70,9 @@ fn is_structural_partial_eq<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, other: T impl<'tcx> LateLintPass<'tcx> for PatternEquality { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { - if !in_external_macro(cx.sess(), expr.span) - && let ExprKind::Let(let_expr) = expr.kind + if let ExprKind::Let(let_expr) = expr.kind && unary_pattern(let_expr.pat) + && !in_external_macro(cx.sess(), expr.span) { let exp_ty = cx.typeck_results().expr_ty(let_expr.init); let pat_ty = cx.typeck_results().pat_ty(let_expr.pat); |
