1
Fork 0

cfg taken out of Attributes, put in Item

check item.is_fake() instead of self_id.is_some()

Remove empty branching in Attributes::from_ast

diverse small refacto after Josha review

cfg computation moved in merge_attrs

refacto use from_ast twice for coherence

take cfg out of Attributes and move it to Item
This commit is contained in:
Timothée Delabrouille 2021-04-25 18:17:11 +02:00
parent b4f1dfd2c5
commit 727f9040aa
12 changed files with 104 additions and 85 deletions

View file

@ -122,8 +122,8 @@ impl Clean<Item> for doctree::Module<'_> {
}
impl Clean<Attributes> for [ast::Attribute] {
fn clean(&self, cx: &mut DocContext<'_>) -> Attributes {
Attributes::from_ast(cx.sess().diagnostic(), self, None)
fn clean(&self, _cx: &mut DocContext<'_>) -> Attributes {
Attributes::from_ast(self, None)
}
}
@ -1998,6 +1998,7 @@ fn clean_extern_crate(
return items;
}
}
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
vec![Item {
name: Some(name),
@ -2005,6 +2006,7 @@ fn clean_extern_crate(
def_id: crate_def_id,
visibility: krate.vis.clean(cx),
kind: box ExternCrateItem { src: orig_name },
cfg: attrs.cfg(cx.sess().diagnostic()),
}]
}