@@ -1701,8 +1701,9 @@ impl ModCollector<'_, '_> {
1701
1701
{
1702
1702
Ok ( ( file_id, is_mod_rs, mod_dir) ) => {
1703
1703
let item_tree = db. file_item_tree ( file_id. into ( ) ) ;
1704
+ let krate = self . def_collector . def_map . krate ;
1704
1705
let is_enabled = item_tree
1705
- . top_level_attrs ( db, self . def_collector . def_map . krate )
1706
+ . top_level_attrs ( db, krate)
1706
1707
. cfg ( )
1707
1708
. map_or ( true , |cfg| self . is_cfg_enabled ( & cfg) ) ;
1708
1709
if is_enabled {
@@ -1713,7 +1714,7 @@ impl ModCollector<'_, '_> {
1713
1714
& self . item_tree [ module. visibility ] ,
1714
1715
) ;
1715
1716
ModCollector {
1716
- def_collector : & mut * self . def_collector ,
1717
+ def_collector : self . def_collector ,
1717
1718
macro_depth : self . macro_depth ,
1718
1719
module_id,
1719
1720
tree_id : TreeId :: new ( file_id. into ( ) , None ) ,
@@ -1723,7 +1724,7 @@ impl ModCollector<'_, '_> {
1723
1724
. collect_in_top_module ( item_tree. top_level_items ( ) ) ;
1724
1725
let is_macro_use = is_macro_use
1725
1726
|| item_tree
1726
- . top_level_attrs ( db, self . def_collector . def_map . krate )
1727
+ . top_level_attrs ( db, krate)
1727
1728
. by_key ( "macro_use" )
1728
1729
. exists ( ) ;
1729
1730
if is_macro_use {
@@ -1748,12 +1749,11 @@ impl ModCollector<'_, '_> {
1748
1749
definition : Option < ( FileId , bool ) > ,
1749
1750
visibility : & crate :: visibility:: RawVisibility ,
1750
1751
) -> LocalModuleId {
1751
- let vis = self
1752
- . def_collector
1753
- . def_map
1752
+ let def_map = & mut self . def_collector . def_map ;
1753
+ let vis = def_map
1754
1754
. resolve_visibility ( self . def_collector . db , self . module_id , visibility)
1755
1755
. unwrap_or ( Visibility :: Public ) ;
1756
- let modules = & mut self . def_collector . def_map . modules ;
1756
+ let modules = & mut def_map. modules ;
1757
1757
let origin = match definition {
1758
1758
None => ModuleOrigin :: Inline { definition : declaration } ,
1759
1759
Some ( ( definition, is_mod_rs) ) => {
@@ -1768,10 +1768,10 @@ impl ModCollector<'_, '_> {
1768
1768
}
1769
1769
modules[ self . module_id ] . children . insert ( name. clone ( ) , res) ;
1770
1770
1771
- let module = self . def_collector . def_map . module_id ( res) ;
1771
+ let module = def_map. module_id ( res) ;
1772
1772
let def = ModuleDefId :: from ( module) ;
1773
1773
1774
- self . def_collector . def_map . modules [ self . module_id ] . scope . declare ( def) ;
1774
+ def_map. modules [ self . module_id ] . scope . declare ( def) ;
1775
1775
self . def_collector . update (
1776
1776
self . module_id ,
1777
1777
& [ ( Some ( name) , PerNs :: from_def ( def, vis, false ) ) ] ,
0 commit comments