Changes to RustDoc

This commit is contained in:
Nick Cameron
2014-12-24 22:34:57 +13:00
parent 4688aadfde
commit c4640a2a69
7 changed files with 34 additions and 56 deletions

View File

@@ -97,9 +97,6 @@ impl fmt::Show for clean::Generics {
if i > 0 {
try!(f.write(", ".as_bytes()))
}
if let Some(ref unbound) = tp.default_unbound {
try!(write!(f, "{}? ", unbound));
};
try!(f.write(tp.name.as_bytes()));
if tp.bounds.len() > 0 {
@@ -182,8 +179,12 @@ impl fmt::Show for clean::TyParamBound {
clean::RegionBound(ref lt) => {
write!(f, "{}", *lt)
}
clean::TraitBound(ref ty) => {
write!(f, "{}", *ty)
clean::TraitBound(ref ty, modifier) => {
let modifier_str = match modifier {
ast::TraitBoundModifier::None => "",
ast::TraitBoundModifier::Maybe => "?",
};
write!(f, "{}{}", modifier_str, *ty)
}
}
}
@@ -458,12 +459,15 @@ impl fmt::Show for clean::Type {
for bound in decl.bounds.iter() {
match *bound {
clean::RegionBound(..) => {}
clean::TraitBound(ref t) => {
clean::TraitBound(ref t, modifier) => {
if ret.len() == 0 {
ret.push_str(": ");
} else {
ret.push_str(" + ");
}
if modifier == ast::TraitBoundModifier::Maybe {
ret.push_str("?");
}
ret.push_str(format!("{}",
*t).as_slice());
}