@@ -4,7 +4,6 @@ use std::sync::Arc;
4
4
5
5
use rustc_ast:: token:: { Token , TokenKind } ;
6
6
use rustc_ast:: tokenstream:: { TokenStream , TokenTree } ;
7
- use rustc_hir:: def_id:: LocalDefId ;
8
7
use rustc_hir:: { AttrArgs , Attribute } ;
9
8
use rustc_span:: symbol:: sym;
10
9
@@ -22,13 +21,12 @@ pub(crate) const PROPAGATE_DOC_CFG: Pass = Pass {
22
21
} ;
23
22
24
23
pub ( 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 ( ) }
26
25
. fold_crate ( cr)
27
26
}
28
27
29
28
struct CfgPropagator < ' a , ' tcx > {
30
29
parent_cfg : Option < Arc < Cfg > > ,
31
- parent : Option < LocalDefId > ,
32
30
cx : & ' a mut DocContext < ' tcx > ,
33
31
cfg_info : CfgInfo ,
34
32
}
@@ -136,16 +134,9 @@ impl DocFolder for CfgPropagator<'_, '_> {
136
134
self . merge_with_parent_attributes ( & mut item) ;
137
135
self . parent_cfg = item. inner . cfg . clone ( ) ;
138
136
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
- } ;
145
137
let result = self . fold_item_recur ( item) ;
146
138
self . cfg_info = old_cfg_info;
147
139
self . parent_cfg = old_parent_cfg;
148
- self . parent = old_parent;
149
140
150
141
Some ( result)
151
142
}
0 commit comments