@@ -30,28 +30,23 @@ pub(super) fn hints(
3030 . filter_map ( |( p, arg) | {
3131 // Only annotate hints for expressions that exist in the original file
3232 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 ( ) {
3435 Either :: Left ( pat) => ( pat. name ( ) ?, pat. name ( ) ) ,
3536 Either :: Right ( param) => match param. pat ( ) ? {
3637 ast:: Pat :: IdentPat ( it) => ( it. name ( ) ?, it. name ( ) ) ,
3738 _ => return None ,
3839 } ,
3940 } ;
41+ // make sure the file is cached so we can map out of macros
42+ sema. parse_or_expand ( source. file_id ) ;
4043 Some ( ( name_syntax, param_name, arg, range) )
4144 } )
4245 . filter ( |( _, param_name, arg, _) | {
4346 !should_hide_param_name_hint ( sema, & callable, & param_name. text ( ) , arg)
4447 } )
4548 . 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 ( ) ) ) ;
5550
5651 let colon = if config. render_colons { ":" } else { "" } ;
5752 let label =
0 commit comments