@@ -20,17 +20,11 @@ use crate::clean::{self, AttributesExt, NestedAttributesExt, def_id_to_path};
20
20
use crate :: doctree:: * ;
21
21
22
22
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
-
28
23
// Also, is there some reason that this doesn't use the 'visit'
29
24
// framework from syntax?.
30
25
31
26
pub struct RustdocVisitor < ' a , ' tcx > {
32
- pub module : Option < Module < ' tcx > > ,
33
- pub cx : & ' a core:: DocContext < ' tcx > ,
27
+ cx : & ' a core:: DocContext < ' tcx > ,
34
28
view_item_stack : FxHashSet < hir:: HirId > ,
35
29
inlining : bool ,
36
30
/// Are the current module and all of its parents public?
@@ -46,7 +40,6 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
46
40
let mut stack = FxHashSet :: default ( ) ;
47
41
stack. insert ( hir:: CRATE_HIR_ID ) ;
48
42
RustdocVisitor {
49
- module : None ,
50
43
cx,
51
44
view_item_stack : stack,
52
45
inlining : false ,
@@ -75,7 +68,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
75
68
. and_then ( |def_id| self . cx . tcx . lookup_deprecation ( def_id) )
76
69
}
77
70
78
- pub fn visit ( & mut self , krate : & ' tcx hir:: Crate ) {
71
+ pub fn visit ( & mut self , krate : & ' tcx hir:: Crate ) -> Module < ' tcx > {
79
72
let mut module = self . visit_mod_contents ( krate. span ,
80
73
& krate. attrs ,
81
74
& Spanned { span : syntax_pos:: DUMMY_SP ,
@@ -88,9 +81,10 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
88
81
krate. exported_macros . iter ( ) . map ( |def| self . visit_local_macro ( def, None ) ) ,
89
82
) ;
90
83
module. is_crate = true ;
91
- self . module = Some ( module) ;
92
84
93
85
self . cx . renderinfo . borrow_mut ( ) . exact_paths = self . exact_paths . take ( ) . unwrap ( ) ;
86
+
87
+ module
94
88
}
95
89
96
90
pub fn visit_variant_data ( & mut self , item : & ' tcx hir:: Item ,
0 commit comments