@@ -20,17 +20,11 @@ use crate::clean::{self, AttributesExt, NestedAttributesExt, def_id_to_path};
2020use crate :: doctree:: * ;
2121
2222
23- // Looks to me like the first two of these are actually
24- // output parameters, maybe only mutated once; perhaps
25- // better simply to have the visit method return a tuple
26- // containing them?
27-
2823// Also, is there some reason that this doesn't use the 'visit'
2924// framework from syntax?.
3025
3126pub struct RustdocVisitor < ' a , ' tcx > {
32- pub module : Option < Module < ' tcx > > ,
33- pub cx : & ' a core:: DocContext < ' tcx > ,
27+ cx : & ' a core:: DocContext < ' tcx > ,
3428 view_item_stack : FxHashSet < hir:: HirId > ,
3529 inlining : bool ,
3630 /// Are the current module and all of its parents public?
@@ -46,7 +40,6 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
4640 let mut stack = FxHashSet :: default ( ) ;
4741 stack. insert ( hir:: CRATE_HIR_ID ) ;
4842 RustdocVisitor {
49- module : None ,
5043 cx,
5144 view_item_stack : stack,
5245 inlining : false ,
@@ -75,7 +68,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
7568 . and_then ( |def_id| self . cx . tcx . lookup_deprecation ( def_id) )
7669 }
7770
78- pub fn visit ( & mut self , krate : & ' tcx hir:: Crate ) {
71+ pub fn visit ( & mut self , krate : & ' tcx hir:: Crate ) -> Module < ' tcx > {
7972 let mut module = self . visit_mod_contents ( krate. span ,
8073 & krate. attrs ,
8174 & Spanned { span : syntax_pos:: DUMMY_SP ,
@@ -88,9 +81,10 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
8881 krate. exported_macros . iter ( ) . map ( |def| self . visit_local_macro ( def, None ) ) ,
8982 ) ;
9083 module. is_crate = true ;
91- self . module = Some ( module) ;
9284
9385 self . cx . renderinfo . borrow_mut ( ) . exact_paths = self . exact_paths . take ( ) . unwrap ( ) ;
86+
87+ module
9488 }
9589
9690 pub fn visit_variant_data ( & mut self , item : & ' tcx hir:: Item ,
0 commit comments