rustdoc: Cleanup associated const value rendering

Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.

Also cleans up adding parens around references to trait objects.
This commit is contained in:
Oliver Middleton
2017-05-31 18:02:35 +01:00
parent fd7b44b78e
commit 86ea93e83c
4 changed files with 74 additions and 156 deletions

View File

@@ -1662,9 +1662,9 @@ fn md_render_assoc_item(item: &clean::Item) -> String {
match item.inner {
clean::AssociatedConstItem(ref ty, ref default) => {
if let Some(default) = default.as_ref() {
format!("```\n{}: {:?} = {}\n```\n\n", item.name.as_ref().unwrap(), ty, default)
format!("```\n{}: {:#} = {}\n```\n\n", item.name.as_ref().unwrap(), ty, default)
} else {
format!("```\n{}: {:?}\n```\n\n", item.name.as_ref().unwrap(), ty)
format!("```\n{}: {:#}\n```\n\n", item.name.as_ref().unwrap(), ty)
}
}
_ => String::new(),