This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
crates/ide-assists/src/handlers Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -314,19 +314,17 @@ impl Module {
314314 ) {
315315 let mod_name = self . name ;
316316 let out_of_sel = |node : & SyntaxNode | !self . text_range . contains_range ( node. text_range ( ) ) ;
317+
317318 for ( file_id, refs) in node_def. usages ( & ctx. sema ) . all ( ) {
318319 let source_file = ctx. sema . parse ( file_id) ;
319320 let usages = refs. into_iter ( ) . filter_map ( |FileReference { range, name, .. } | {
320- let path: ast:: Path = find_node_at_range ( source_file. syntax ( ) , range) ?;
321+ // handle normal usages
322+ let name_ref = find_node_at_range :: < ast:: NameRef > ( source_file. syntax ( ) , range) ?;
321323 let name = name. syntax ( ) . to_string ( ) ;
322324
323- for desc in path. syntax ( ) . descendants ( ) {
324- if desc. to_string ( ) == name && out_of_sel ( & desc) {
325- if let Some ( name_ref) = ast:: NameRef :: cast ( desc) {
326- let new_ref = format ! ( "{mod_name}::{name_ref}" ) ;
327- return Some ( ( name_ref. syntax ( ) . text_range ( ) , new_ref) ) ;
328- }
329- }
325+ if out_of_sel ( name_ref. syntax ( ) ) {
326+ let new_ref = format ! ( "{mod_name}::{name_ref}" ) ;
327+ return Some ( ( name_ref. syntax ( ) . text_range ( ) , new_ref) ) ;
330328 }
331329
332330 None
You can’t perform that action at this time.
0 commit comments