1
Fork 0

Updates with core::fmt changes

1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used
   instead.
2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro
   is preferred wherever possible.
3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
This commit is contained in:
Alex Crichton 2014-05-10 14:05:06 -07:00
parent 8767093eb9
commit 1de4b65d2a
59 changed files with 274 additions and 290 deletions

View file

@ -174,17 +174,17 @@ impl TocBuilder {
impl fmt::Show for Toc {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt.buf, "<ul>"));
try!(write!(fmt, "<ul>"));
for entry in self.entries.iter() {
// recursively format this table of contents (the
// `{children}` is the key).
try!(write!(fmt.buf,
try!(write!(fmt,
"\n<li><a href=\"\\#{id}\">{num} {name}</a>{children}</li>",
id = entry.id,
num = entry.sec_number, name = entry.name,
children = entry.children))
}
write!(fmt.buf, "</ul>")
write!(fmt, "</ul>")
}
}