1
Fork 0

add declaration blocks to attribute/derive pages

This commit is contained in:
QuietMisdreavus 2018-09-26 09:18:58 -05:00
parent 8f69a82513
commit 869ebc4f95

View file

@ -4611,10 +4611,24 @@ fn item_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
fn item_proc_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, m: &clean::ProcMacro) fn item_proc_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, m: &clean::ProcMacro)
-> fmt::Result -> fmt::Result
{ {
if m.kind == MacroKind::Bang { let name = it.name.as_ref().expect("proc-macros always have names");
write!(w, "<pre class='rust macro'>")?; match m.kind {
write!(w, "{}!() {{ /* proc-macro */ }}", it.name.as_ref().unwrap())?; MacroKind::Bang => {
write!(w, "</pre>")?; write!(w, "<pre class='rust macro'>")?;
write!(w, "{}!() {{ /* proc-macro */ }}", name)?;
write!(w, "</pre>")?;
}
MacroKind::Attr => {
write!(w, "<pre class='rust attr'>")?;
write!(w, "#[{}]", name)?;
write!(w, "</pre>")?;
}
MacroKind::Derive => {
write!(w, "<pre class='rust derive'>")?;
write!(w, "#[derive({})]", name)?;
write!(w, "</pre>")?;
}
_ => {}
} }
document(w, cx, it) document(w, cx, it)
} }