From 7b64622780bfa33c593ba856bdb6cfc31b220265 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 13 Feb 2021 23:35:04 +0100 Subject: Don't rename field record patterns directly --- crates/syntax/src/ast/node_ext.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/syntax/src') diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index b105cb0e0..307e150e9 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -3,12 +3,11 @@ use std::fmt; -use ast::AttrsOwner; use itertools::Itertools; use parser::SyntaxKind; use crate::{ - ast::{self, support, AstNode, AstToken, NameOwner, SyntaxNode}, + ast::{self, support, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode}, SmolStr, SyntaxElement, SyntaxToken, T, }; @@ -324,7 +323,7 @@ impl ast::RecordPatField { pub fn for_field_name(field_name: &ast::Name) -> Option { let candidate = - field_name.syntax().ancestors().nth(3).and_then(ast::RecordPatField::cast)?; + field_name.syntax().ancestors().nth(2).and_then(ast::RecordPatField::cast)?; match candidate.field_name()? { NameOrNameRef::Name(name) if name == *field_name => Some(candidate), _ => None, -- cgit v1.2.3