about summary refs log tree commit diff
path: root/clippy_lints/src
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2024-12-11 02:17:28 +0000
committerGitHub <noreply@github.com>2024-12-11 02:17:28 +0000
commitc2d23ad0df5b3603ea0a1d2f4892fb84faaf8a3f (patch)
treedebad8c5f99699e00d6ef4b13372778f5a8856db /clippy_lints/src
parent59740a8eb1081fba7a25b60ab7d7acae98f1d3bd (diff)
parentf51f72b400b554effa48811534219430b68f3861 (diff)
downloadrust-c2d23ad0df5b3603ea0a1d2f4892fb84faaf8a3f.tar.gz
rust-c2d23ad0df5b3603ea0a1d2f4892fb84faaf8a3f.zip
Detect shadowing in pattern field (#13797)
Fix #13795

changelog: [`shadow_same`]: detect shadowing as a pattern field
Diffstat (limited to 'clippy_lints/src')
-rw-r--r--clippy_lints/src/shadow.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs
index 49d22377119..83199ba0f70 100644
--- a/clippy_lints/src/shadow.rs
+++ b/clippy_lints/src/shadow.rs
@@ -263,7 +263,7 @@ fn is_self_shadow(cx: &LateContext<'_>, pat: &Pat<'_>, mut expr: &Expr<'_>, hir_
 fn find_init<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Option<(&'tcx Expr<'tcx>, Option<HirId>)> {
     for (hir_id, node) in cx.tcx.hir().parent_iter(hir_id) {
         let init = match node {
-            Node::Arm(_) | Node::Pat(_) | Node::Param(_) => continue,
+            Node::Arm(_) | Node::Pat(_) | Node::PatField(_) | Node::Param(_) => continue,
             Node::Expr(expr) => match expr.kind {
                 ExprKind::Match(e, _, _) | ExprKind::Let(&LetExpr { init: e, .. }) => Some((e, None)),
                 // If we're a closure argument, then a parent call is also an associated item.