@@ -4,16 +4,11 @@ use indexmap::IndexMap;
4
4
5
5
use hir:: db:: AstDatabase ;
6
6
use ra_ide_db:: RootDatabase ;
7
- use ra_syntax:: {
8
- ast:: { self , DocCommentsOwner } ,
9
- match_ast, AstNode , TextRange ,
10
- } ;
7
+ use ra_syntax:: { ast, match_ast, AstNode , TextRange } ;
11
8
12
9
use crate :: {
13
- call_info:: FnCallNode ,
14
- display:: { ShortLabel , ToNav } ,
15
- expand:: descend_into_macros,
16
- goto_definition, references, FilePosition , NavigationTarget , RangeInfo ,
10
+ call_info:: FnCallNode , display:: ToNav , expand:: descend_into_macros, goto_definition,
11
+ references, FilePosition , NavigationTarget , RangeInfo ,
17
12
} ;
18
13
19
14
#[ derive( Debug , Clone ) ]
@@ -49,6 +44,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
49
44
let refs = references:: find_all_refs ( db, position, None ) ?;
50
45
51
46
let mut calls = CallLocations :: default ( ) ;
47
+ let mut sb = hir:: SourceBinder :: new ( db) ;
52
48
53
49
for reference in refs. info . references ( ) {
54
50
let file_id = reference. file_range . file_id ;
@@ -62,12 +58,8 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
62
58
match_ast ! {
63
59
match node {
64
60
ast:: FnDef ( it) => {
65
- Some ( NavigationTarget :: from_named(
66
- db,
67
- token. with_value( & it) ,
68
- it. doc_comment_text( ) ,
69
- it. short_label( ) ,
70
- ) )
61
+ let def = sb. to_def( token. with_value( it) ) ?;
62
+ Some ( def. to_nav( sb. db) )
71
63
} ,
72
64
_ => { None } ,
73
65
}
0 commit comments