@@ -29,7 +29,7 @@ pub struct RustdocVisitor<'a, 'tcx> {
29
29
inlining : bool ,
30
30
/// Are the current module and all of its parents public?
31
31
inside_public_path : bool ,
32
- exact_paths : Option < FxHashMap < DefId , Vec < String > > > ,
32
+ exact_paths : FxHashMap < DefId , Vec < String > > ,
33
33
}
34
34
35
35
impl < ' a , ' tcx > RustdocVisitor < ' a , ' tcx > {
@@ -44,17 +44,16 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
44
44
view_item_stack : stack,
45
45
inlining : false ,
46
46
inside_public_path : true ,
47
- exact_paths : Some ( FxHashMap :: default ( ) ) ,
47
+ exact_paths : FxHashMap :: default ( ) ,
48
48
}
49
49
}
50
50
51
51
fn store_path ( & mut self , did : DefId ) {
52
52
// We can't use the entry API, as that keeps the mutable borrow of `self` active
53
53
// when we try to use `cx`.
54
- let exact_paths = self . exact_paths . as_mut ( ) . unwrap ( ) ;
55
- if exact_paths. get ( & did) . is_none ( ) {
54
+ if self . exact_paths . get ( & did) . is_none ( ) {
56
55
let path = def_id_to_path ( self . cx , did, self . cx . crate_name . clone ( ) ) ;
57
- exact_paths. insert ( did, path) ;
56
+ self . exact_paths . insert ( did, path) ;
58
57
}
59
58
}
60
59
@@ -82,12 +81,12 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
82
81
) ;
83
82
module. is_crate = true ;
84
83
85
- self . cx . renderinfo . borrow_mut ( ) . exact_paths = self . exact_paths . take ( ) . unwrap ( ) ;
84
+ self . cx . renderinfo . borrow_mut ( ) . exact_paths = self . exact_paths ;
86
85
87
86
module
88
87
}
89
88
90
- pub fn visit_variant_data ( & mut self , item : & ' tcx hir:: Item ,
89
+ fn visit_variant_data ( & mut self , item : & ' tcx hir:: Item ,
91
90
name : ast:: Name , sd : & ' tcx hir:: VariantData ,
92
91
generics : & ' tcx hir:: Generics ) -> Struct < ' tcx > {
93
92
debug ! ( "visiting struct" ) ;
@@ -106,7 +105,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
106
105
}
107
106
}
108
107
109
- pub fn visit_union_data ( & mut self , item : & ' tcx hir:: Item ,
108
+ fn visit_union_data ( & mut self , item : & ' tcx hir:: Item ,
110
109
name : ast:: Name , sd : & ' tcx hir:: VariantData ,
111
110
generics : & ' tcx hir:: Generics ) -> Union < ' tcx > {
112
111
debug ! ( "visiting union" ) ;
@@ -125,7 +124,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
125
124
}
126
125
}
127
126
128
- pub fn visit_enum_def ( & mut self , it : & ' tcx hir:: Item ,
127
+ fn visit_enum_def ( & mut self , it : & ' tcx hir:: Item ,
129
128
name : ast:: Name , def : & ' tcx hir:: EnumDef ,
130
129
generics : & ' tcx hir:: Generics ) -> Enum < ' tcx > {
131
130
debug ! ( "visiting enum" ) ;
@@ -150,7 +149,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
150
149
}
151
150
}
152
151
153
- pub fn visit_fn ( & mut self , om : & mut Module < ' tcx > , item : & ' tcx hir:: Item ,
152
+ fn visit_fn ( & mut self , om : & mut Module < ' tcx > , item : & ' tcx hir:: Item ,
154
153
name : ast:: Name , decl : & ' tcx hir:: FnDecl ,
155
154
header : hir:: FnHeader ,
156
155
generics : & ' tcx hir:: Generics ,
@@ -223,7 +222,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
223
222
}
224
223
}
225
224
226
- pub fn visit_mod_contents ( & mut self , span : Span , attrs : & ' tcx hir:: HirVec < ast:: Attribute > ,
225
+ fn visit_mod_contents ( & mut self , span : Span , attrs : & ' tcx hir:: HirVec < ast:: Attribute > ,
227
226
vis : & ' tcx hir:: Visibility , id : hir:: HirId ,
228
227
m : & ' tcx hir:: Mod ,
229
228
name : Option < ast:: Name > ) -> Module < ' tcx > {
@@ -363,7 +362,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
363
362
ret
364
363
}
365
364
366
- pub fn visit_item ( & mut self , item : & ' tcx hir:: Item ,
365
+ fn visit_item ( & mut self , item : & ' tcx hir:: Item ,
367
366
renamed : Option < ast:: Ident > , om : & mut Module < ' tcx > ) {
368
367
debug ! ( "visiting item {:?}" , item) ;
369
368
let ident = renamed. unwrap_or ( item. ident ) ;
0 commit comments