@@ -85,10 +85,11 @@ pub enum HoverAction {
8585
8686impl HoverAction {
8787 fn goto_type_from_targets (
88- db : & RootDatabase ,
88+ sema : & Semantics < ' _ , RootDatabase > ,
8989 targets : Vec < hir:: ModuleDef > ,
9090 edition : Edition ,
9191 ) -> Option < Self > {
92+ let db = sema. db ;
9293 let targets = targets
9394 . into_iter ( )
9495 . filter_map ( |it| {
@@ -99,7 +100,7 @@ impl HoverAction {
99100 it. name ( db) . map ( |name| name. display ( db, edition) . to_string ( ) ) ,
100101 edition,
101102 ) ,
102- nav : it. try_to_nav ( db ) ?. call_site ( ) ,
103+ nav : it. try_to_nav ( sema ) ?. call_site ( ) ,
103104 } )
104105 } )
105106 . collect :: < Vec < _ > > ( ) ;
@@ -467,10 +468,10 @@ pub(crate) fn hover_for_definition(
467468 HoverResult {
468469 markup : render:: process_markup ( sema. db , def, & markup, range_map, config) ,
469470 actions : [
470- show_fn_references_action ( sema. db , def) ,
471- show_implementations_action ( sema. db , def) ,
471+ show_fn_references_action ( sema, def) ,
472+ show_implementations_action ( sema, def) ,
472473 runnable_action ( sema, def, file_id) ,
473- goto_type_action_for_def ( sema. db , def, & notable_traits, subst_types, edition) ,
474+ goto_type_action_for_def ( sema, def, & notable_traits, subst_types, edition) ,
474475 ]
475476 . into_iter ( )
476477 . flatten ( )
@@ -505,7 +506,10 @@ fn notable_traits<'db>(
505506 . collect :: < Vec < _ > > ( )
506507}
507508
508- fn show_implementations_action ( db : & RootDatabase , def : Definition ) -> Option < HoverAction > {
509+ fn show_implementations_action (
510+ sema : & Semantics < ' _ , RootDatabase > ,
511+ def : Definition ,
512+ ) -> Option < HoverAction > {
509513 fn to_action ( nav_target : NavigationTarget ) -> HoverAction {
510514 HoverAction :: Implementation ( FilePosition {
511515 file_id : nav_target. file_id ,
@@ -515,19 +519,22 @@ fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<Hov
515519
516520 let adt = match def {
517521 Definition :: Trait ( it) => {
518- return it. try_to_nav ( db ) . map ( UpmappingResult :: call_site) . map ( to_action) ;
522+ return it. try_to_nav ( sema ) . map ( UpmappingResult :: call_site) . map ( to_action) ;
519523 }
520524 Definition :: Adt ( it) => Some ( it) ,
521- Definition :: SelfType ( it) => it. self_ty ( db) . as_adt ( ) ,
525+ Definition :: SelfType ( it) => it. self_ty ( sema . db ) . as_adt ( ) ,
522526 _ => None ,
523527 } ?;
524- adt. try_to_nav ( db ) . map ( UpmappingResult :: call_site) . map ( to_action)
528+ adt. try_to_nav ( sema ) . map ( UpmappingResult :: call_site) . map ( to_action)
525529}
526530
527- fn show_fn_references_action ( db : & RootDatabase , def : Definition ) -> Option < HoverAction > {
531+ fn show_fn_references_action (
532+ sema : & Semantics < ' _ , RootDatabase > ,
533+ def : Definition ,
534+ ) -> Option < HoverAction > {
528535 match def {
529536 Definition :: Function ( it) => {
530- it. try_to_nav ( db ) . map ( UpmappingResult :: call_site) . map ( |nav_target| {
537+ it. try_to_nav ( sema ) . map ( UpmappingResult :: call_site) . map ( |nav_target| {
531538 HoverAction :: Reference ( FilePosition {
532539 file_id : nav_target. file_id ,
533540 offset : nav_target. focus_or_full_range ( ) . start ( ) ,
@@ -560,12 +567,13 @@ fn runnable_action(
560567}
561568
562569fn goto_type_action_for_def (
563- db : & RootDatabase ,
570+ sema : & Semantics < ' _ , RootDatabase > ,
564571 def : Definition ,
565572 notable_traits : & [ ( hir:: Trait , Vec < ( Option < hir:: Type < ' _ > > , hir:: Name ) > ) ] ,
566573 subst_types : Option < Vec < ( hir:: Symbol , hir:: Type < ' _ > ) > > ,
567574 edition : Edition ,
568575) -> Option < HoverAction > {
576+ let db = sema. db ;
569577 let mut targets: Vec < hir:: ModuleDef > = Vec :: new ( ) ;
570578 let mut push_new_def = |item : hir:: ModuleDef | {
571579 if !targets. contains ( & item) {
@@ -612,7 +620,7 @@ fn goto_type_action_for_def(
612620 }
613621 }
614622
615- HoverAction :: goto_type_from_targets ( db , targets, edition)
623+ HoverAction :: goto_type_from_targets ( sema , targets, edition)
616624}
617625
618626fn walk_and_push_ty (
0 commit comments