Skip to content

Commit 71369a1

Browse files
Remove useless code in propagate_doc_cfg.rs
1 parent 2773990 commit 71369a1

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

Diff for: src/librustdoc/passes/propagate_doc_cfg.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::sync::Arc;
44

55
use rustc_ast::token::{Token, TokenKind};
66
use rustc_ast::tokenstream::{TokenStream, TokenTree};
7-
use rustc_hir::def_id::LocalDefId;
87
use rustc_hir::{AttrArgs, Attribute};
98
use rustc_span::symbol::sym;
109

@@ -22,13 +21,12 @@ pub(crate) const PROPAGATE_DOC_CFG: Pass = Pass {
2221
};
2322

2423
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() }
2625
.fold_crate(cr)
2726
}
2827

2928
struct 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

Comments
 (0)