@@ -37,8 +37,8 @@ use fst::{self, Streamer};
37
37
use hir:: {
38
38
db:: { DefDatabase , HirDatabase } ,
39
39
AdtId , AssocContainerId , AssocItemId , AssocItemLoc , DefHasSource , DefWithBodyId , HasSource ,
40
- HirFileId , ImplId , InFile , ItemLoc , ItemTreeNode , Lookup , MacroDef , ModuleDefId , ModuleId ,
41
- Semantics , TraitId ,
40
+ HirFileId , ImplId , InFile , ItemLoc , ItemTreeNode , Lookup , MacroDef , Module , ModuleDefId ,
41
+ ModuleId , Semantics , TraitId ,
42
42
} ;
43
43
use rayon:: prelude:: * ;
44
44
use rustc_hash:: FxHashSet ;
@@ -472,8 +472,7 @@ impl<'a> SymbolCollector<'a> {
472
472
473
473
fn collect_from_module ( & mut self , module_id : ModuleId ) {
474
474
let def_map = module_id. def_map ( self . db . upcast ( ) ) ;
475
- let module_data = & def_map[ module_id. local_id ] ;
476
- let scope = & module_data. scope ;
475
+ let scope = & def_map[ module_id. local_id ] . scope ;
477
476
478
477
for module_def_id in scope. declarations ( ) {
479
478
match module_def_id {
@@ -594,20 +593,15 @@ impl<'a> SymbolCollector<'a> {
594
593
T : ItemTreeNode ,
595
594
<T as ItemTreeNode >:: Source : HasName ,
596
595
{
597
- fn container_name ( db : & dyn DefDatabase , container : AssocContainerId ) -> Option < SmolStr > {
596
+ fn container_name ( db : & dyn HirDatabase , container : AssocContainerId ) -> Option < SmolStr > {
598
597
match container {
599
598
AssocContainerId :: ModuleId ( module_id) => {
600
- let def_map = module_id. def_map ( db) ;
601
- let module_data = & def_map[ module_id. local_id ] ;
602
- module_data
603
- . origin
604
- . declaration ( )
605
- . and_then ( |s| s. to_node ( db. upcast ( ) ) . name ( ) . map ( |n| n. text ( ) . into ( ) ) )
599
+ let module = Module :: from ( module_id) ;
600
+ module. name ( db) . and_then ( |name| name. as_text ( ) )
606
601
}
607
602
AssocContainerId :: TraitId ( trait_id) => {
608
- let loc = trait_id. lookup ( db) ;
609
- let source = loc. source ( db) ;
610
- source. value . name ( ) . map ( |n| n. text ( ) . into ( ) )
603
+ let trait_data = db. trait_data ( trait_id) ;
604
+ trait_data. name . as_text ( )
611
605
}
612
606
AssocContainerId :: ImplId ( _) => None ,
613
607
}
0 commit comments