1
Fork 0

Auto merge of #84494 - tdelabro:84304-bis, r=jyn514

84304 - rustdoc: shrink Item::Attributes

Helps with https://github.com/rust-lang/rust/issues/84304
This commit is contained in:
bors 2021-04-27 20:19:57 +00:00
commit 727d101561
16 changed files with 158 additions and 128 deletions

View file

@ -608,17 +608,12 @@ fn document_item_info(
}
fn portability(item: &clean::Item, parent: Option<&clean::Item>) -> Option<String> {
let cfg = match (&item.attrs.cfg, parent.and_then(|p| p.attrs.cfg.as_ref())) {
let cfg = match (&item.cfg, parent.and_then(|p| p.cfg.as_ref())) {
(Some(cfg), Some(parent_cfg)) => cfg.simplify_with(parent_cfg),
(cfg, _) => cfg.as_deref().cloned(),
};
debug!(
"Portability {:?} - {:?} = {:?}",
item.attrs.cfg,
parent.and_then(|p| p.attrs.cfg.as_ref()),
cfg
);
debug!("Portability {:?} - {:?} = {:?}", item.cfg, parent.and_then(|p| p.cfg.as_ref()), cfg);
Some(format!("<div class=\"stab portability\">{}</div>", cfg?.render_long_html()))
}