@@ -30,28 +30,23 @@ pub(super) fn hints(
30
30
. filter_map ( |( p, arg) | {
31
31
// Only annotate hints for expressions that exist in the original file
32
32
let range = sema. original_range_opt ( arg. syntax ( ) ) ?;
33
- let ( param_name, name_syntax) = match p. source ( sema. db ) ?. value . as_ref ( ) {
33
+ let source = p. source ( sema. db ) ?;
34
+ let ( param_name, name_syntax) = match source. value . as_ref ( ) {
34
35
Either :: Left ( pat) => ( pat. name ( ) ?, pat. name ( ) ) ,
35
36
Either :: Right ( param) => match param. pat ( ) ? {
36
37
ast:: Pat :: IdentPat ( it) => ( it. name ( ) ?, it. name ( ) ) ,
37
38
_ => return None ,
38
39
} ,
39
40
} ;
41
+ // make sure the file is cached so we can map out of macros
42
+ sema. parse_or_expand ( source. file_id ) ;
40
43
Some ( ( name_syntax, param_name, arg, range) )
41
44
} )
42
45
. filter ( |( _, param_name, arg, _) | {
43
46
!should_hide_param_name_hint ( sema, & callable, & param_name. text ( ) , arg)
44
47
} )
45
48
. map ( |( param, param_name, _, FileRange { range, .. } ) | {
46
- let mut linked_location = None ;
47
- if let Some ( name) = param {
48
- if let hir:: CallableKind :: Function ( f) = callable. kind ( ) {
49
- // assert the file is cached so we can map out of macros
50
- if sema. source ( f) . is_some ( ) {
51
- linked_location = sema. original_range_opt ( name. syntax ( ) ) ;
52
- }
53
- }
54
- }
49
+ let linked_location = param. and_then ( |name| sema. original_range_opt ( name. syntax ( ) ) ) ;
55
50
56
51
let colon = if config. render_colons { ":" } else { "" } ;
57
52
let label =
0 commit comments