Fix rustdoc formatting of impls

Some cases displayed negative impls as positive, and some were missing
where clauses.  This factors all the impl formatting into one
function so the different cases can't get out of sync again.
This commit is contained in:
William Throwe
2015-07-18 02:02:57 -04:00
parent e4e93196e1
commit 456770472b
2 changed files with 18 additions and 24 deletions

View File

@@ -540,6 +540,19 @@ impl fmt::Display for clean::Type {
}
}
impl fmt::Display for clean::Impl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "impl{} ", self.generics));
if let Some(ref ty) = self.trait_ {
try!(write!(f, "{}{} for ",
if self.polarity == Some(clean::ImplPolarity::Negative) { "!" } else { "" },
*ty));
}
try!(write!(f, "{}{}", self.for_, WhereClause(&self.generics)));
Ok(())
}
}
impl fmt::Display for clean::Arguments {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for (i, input) in self.values.iter().enumerate() {