@@ -4,7 +4,6 @@ use std::sync::Arc;
44
55use rustc_ast:: token:: { Token , TokenKind } ;
66use rustc_ast:: tokenstream:: { TokenStream , TokenTree } ;
7- use rustc_hir:: def_id:: LocalDefId ;
87use rustc_hir:: { AttrArgs , Attribute } ;
98use rustc_span:: symbol:: sym;
109
@@ -22,13 +21,12 @@ pub(crate) const PROPAGATE_DOC_CFG: Pass = Pass {
2221} ;
2322
2423pub ( crate ) fn propagate_doc_cfg ( cr : Crate , cx : & mut DocContext < ' _ > ) -> Crate {
25- CfgPropagator { parent_cfg : None , parent : None , cx, cfg_info : CfgInfo :: default ( ) }
24+ CfgPropagator { parent_cfg : None , cx, cfg_info : CfgInfo :: default ( ) }
2625 . fold_crate ( cr)
2726}
2827
2928struct CfgPropagator < ' a , ' tcx > {
3029 parent_cfg : Option < Arc < Cfg > > ,
31- parent : Option < LocalDefId > ,
3230 cx : & ' a mut DocContext < ' tcx > ,
3331 cfg_info : CfgInfo ,
3432}
@@ -136,16 +134,9 @@ impl DocFolder for CfgPropagator<'_, '_> {
136134 self . merge_with_parent_attributes ( & mut item) ;
137135 self . parent_cfg = item. inner . cfg . clone ( ) ;
138136
139- let old_parent =
140- if let Some ( def_id) = item. item_id . as_def_id ( ) . and_then ( |def_id| def_id. as_local ( ) ) {
141- self . parent . replace ( def_id)
142- } else {
143- self . parent . take ( )
144- } ;
145137 let result = self . fold_item_recur ( item) ;
146138 self . cfg_info = old_cfg_info;
147139 self . parent_cfg = old_parent_cfg;
148- self . parent = old_parent;
149140
150141 Some ( result)
151142 }
0 commit comments