refactor: update names and documentation of matchers (cont.) (#1033)

This commit is contained in:
Myriad-Dreamin 2024-12-20 18:35:36 +08:00 committed by GitHub
parent 2ba650a0fd
commit 7dbaca8851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 127 additions and 116 deletions

View file

@ -14,7 +14,7 @@ use crate::{
find_references,
prelude::*,
prepare_renaming,
syntax::{deref_expr, get_index_info, node_ancestors, Decl, RefExpr, SyntaxClass},
syntax::{first_ancestor_expr, get_index_info, node_ancestors, Decl, RefExpr, SyntaxClass},
ty::Interned,
};
@ -243,7 +243,7 @@ impl RenameFileWorker<'_> {
// rename_importer(self.ctx, &ref_src, *span, &self.diff, edits);
let root = LinkedNode::new(src.root());
let import_node = root.find(span).and_then(deref_expr)?;
let import_node = root.find(span).and_then(first_ancestor_expr)?;
let (import_path, has_path_var) = node_ancestors(&import_node).find_map(|import_node| {
match import_node.cast::<ast::Expr>()? {
ast::Expr::Import(import) => Some((