rollup merge of #20194: nick29581/dst-syntax
Part of #19607. r? @nikomatsakis
This commit is contained in:
commit
2a8547783f
41 changed files with 242 additions and 222 deletions
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -1679,9 +1679,6 @@ fn item_function(w: &mut fmt::Formatter, it: &clean::Item,
|
|||
fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||
t: &clean::Trait) -> fmt::Result {
|
||||
let mut bounds = String::new();
|
||||
if let Some(ref ty) = t.default_unbound {
|
||||
bounds.push_str(format!(" for {}?", ty).as_slice());
|
||||
}
|
||||
if t.bounds.len() > 0 {
|
||||
if bounds.len() > 0 {
|
||||
bounds.push(' ');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue