Detect shadowing in pattern field (#13797)
Fix #13795 changelog: [`shadow_same`]: detect shadowing as a pattern field
This commit is contained in:
commit
c2d23ad0df
3 changed files with 22 additions and 2 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue