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 {
314
314
) {
315
315
let mod_name = self . name ;
316
316
let out_of_sel = |node : & SyntaxNode | !self . text_range . contains_range ( node. text_range ( ) ) ;
317
+
317
318
for ( file_id, refs) in node_def. usages ( & ctx. sema ) . all ( ) {
318
319
let source_file = ctx. sema . parse ( file_id) ;
319
320
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) ?;
321
323
let name = name. syntax ( ) . to_string ( ) ;
322
324
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) ) ;
330
328
}
331
329
332
330
None
You can’t perform that action at this time.
0 commit comments