about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-10 14:05:06 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-15 23:22:06 -0700
commit1de4b65d2a88e88201026485f9622916c5717555 (patch)
tree1aa5e8506b8367075cfa4f1546c27df2a943dff9 /src
parent8767093eb98358a1d62a934a58e1c89c72223cd6 (diff)
downloadrust-1de4b65d2a88e88201026485f9622916c5717555.tar.gz
rust-1de4b65d2a88e88201026485f9622916c5717555.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/btree.rs14
-rw-r--r--src/libcollections/hashmap.rs16
-rw-r--r--src/libcollections/lru_cache.rs12
-rw-r--r--src/libcore/prelude.rs2
-rw-r--r--src/libgreen/macros.rs4
-rw-r--r--src/liblog/lib.rs2
-rw-r--r--src/libnum/bigint.rs4
-rw-r--r--src/libnum/complex.rs4
-rw-r--r--src/libnum/rational.rs2
-rw-r--r--src/libregex/parse.rs2
-rw-r--r--src/libregex/re.rs2
-rw-r--r--src/librustc/metadata/tyencode.rs10
-rw-r--r--src/librustc/middle/liveness.rs4
-rw-r--r--src/librustc/middle/ty.rs12
-rw-r--r--src/librustc/middle/typeck/variance.rs6
-rw-r--r--src/librustdoc/html/escape.rs6
-rw-r--r--src/librustdoc/html/format.rs140
-rw-r--r--src/librustdoc/html/layout.rs2
-rw-r--r--src/librustdoc/html/markdown.rs7
-rw-r--r--src/librustdoc/html/render.rs121
-rw-r--r--src/librustdoc/html/toc.rs6
-rw-r--r--src/librustuv/lib.rs2
-rw-r--r--src/librustuv/macros.rs4
-rw-r--r--src/libsemver/lib.rs10
-rw-r--r--src/libserialize/base64.rs4
-rw-r--r--src/libserialize/hex.rs4
-rw-r--r--src/libserialize/json.rs2
-rw-r--r--src/libstd/bitflags.rs2
-rw-r--r--src/libstd/fmt.rs2
-rw-r--r--src/libstd/io/buffered.rs2
-rw-r--r--src/libstd/io/mod.rs4
-rw-r--r--src/libstd/io/net/ip.rs12
-rw-r--r--src/libstd/io/net/udp.rs2
-rw-r--r--src/libstd/io/process.rs4
-rw-r--r--src/libstd/io/stdio.rs6
-rw-r--r--src/libstd/macros.rs7
-rw-r--r--src/libstd/num/strconv.rs3
-rw-r--r--src/libstd/os.rs10
-rw-r--r--src/libstd/repr.rs2
-rw-r--r--src/libstd/rt/unwind.rs6
-rw-r--r--src/libstd/rt/util.rs3
-rw-r--r--src/libsyntax/abi.rs2
-rw-r--r--src/libsyntax/ast.rs6
-rw-r--r--src/libsyntax/ast_map.rs2
-rw-r--r--src/libsyntax/crateid.rs6
-rw-r--r--src/libsyntax/parse/token.rs2
-rw-r--r--src/liburl/lib.rs26
-rw-r--r--src/libuuid/lib.rs18
-rw-r--r--src/test/auxiliary/cci_class_cast.rs2
-rw-r--r--src/test/compile-fail/ifmt-unimpl.rs2
-rw-r--r--src/test/compile-fail/use-after-move-implicity-coerced-object.rs2
-rw-r--r--src/test/run-pass/capturing-logging.rs6
-rw-r--r--src/test/run-pass/class-separate-impl.rs2
-rw-r--r--src/test/run-pass/colorful-write-macros.rs1
-rw-r--r--src/test/run-pass/deriving-show-2.rs2
-rw-r--r--src/test/run-pass/ifmt.rs10
-rw-r--r--src/test/run-pass/issue-2904.rs2
-rw-r--r--src/test/run-pass/issue-3563-3.rs2
-rw-r--r--src/test/run-pass/new-impl-syntax.rs4
59 files changed, 275 insertions, 291 deletions
diff --git a/src/libcollections/btree.rs b/src/libcollections/btree.rs
index 245040d791c..ba83ad8d37c 100644
--- a/src/libcollections/btree.rs
+++ b/src/libcollections/btree.rs
@@ -425,8 +425,8 @@ impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Leaf<K, V> {
     ///Returns a string representation of a Leaf.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         for (i, s) in self.elts.iter().enumerate() {
-            if i != 0 { try!(write!(f.buf, " // ")) }
-            try!(write!(f.buf, "{}", *s))
+            if i != 0 { try!(write!(f, " // ")) }
+            try!(write!(f, "{}", *s))
         }
         Ok(())
     }
@@ -654,10 +654,10 @@ impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Branch<K, V> {
     ///Returns a string representation of a Branch.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         for (i, s) in self.elts.iter().enumerate() {
-            if i != 0 { try!(write!(f.buf, " // ")) }
-            try!(write!(f.buf, "{}", *s))
+            if i != 0 { try!(write!(f, " // ")) }
+            try!(write!(f, "{}", *s))
         }
-        write!(f.buf, " // rightmost child: ({}) ", *self.rightmost_child)
+        write!(f, " // rightmost child: ({}) ", *self.rightmost_child)
     }
 }
 
@@ -715,7 +715,7 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for LeafElt<K, V> {
 impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for LeafElt<K, V> {
     ///Returns a string representation of a LeafElt.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "Key: {}, value: {};", self.key, self.value)
+        write!(f, "Key: {}, value: {};", self.key, self.value)
     }
 }
 
@@ -765,7 +765,7 @@ impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for BranchElt<K, V> {
     /// Returns string containing key, value, and child (which should recur to a
     /// leaf) Consider changing in future to be more readable.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "Key: {}, value: {}, (child: {})",
+        write!(f, "Key: {}, value: {}, (child: {})",
                self.key, self.value, *self.left)
     }
 }
diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs
index 4b9c8ccadd2..4259f458e00 100644
--- a/src/libcollections/hashmap.rs
+++ b/src/libcollections/hashmap.rs
@@ -1418,14 +1418,14 @@ impl<K: TotalEq + Hash<S>, V: Eq, S, H: Hasher<S>> Eq for HashMap<K, V, H> {
 
 impl<K: TotalEq + Hash<S> + Show, V: Show, S, H: Hasher<S>> Show for HashMap<K, V, H> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, r"\{"));
+        try!(write!(f, r"\{"));
 
         for (i, (k, v)) in self.iter().enumerate() {
-            if i != 0 { try!(write!(f.buf, ", ")); }
-            try!(write!(f.buf, "{}: {}", *k, *v));
+            if i != 0 { try!(write!(f, ", ")); }
+            try!(write!(f, "{}: {}", *k, *v));
         }
 
-        write!(f.buf, r"\}")
+        write!(f, r"\}")
     }
 }
 
@@ -1605,14 +1605,14 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> {
 
 impl<T: TotalEq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, r"\{"));
+        try!(write!(f, r"\{"));
 
         for (i, x) in self.iter().enumerate() {
-            if i != 0 { try!(write!(f.buf, ", ")); }
-            try!(write!(f.buf, "{}", *x));
+            if i != 0 { try!(write!(f, ", ")); }
+            try!(write!(f, "{}", *x));
         }
 
-        write!(f.buf, r"\}")
+        write!(f, r"\}")
     }
 }
 
diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs
index 72eefe4f44d..8fdc0e095bf 100644
--- a/src/libcollections/lru_cache.rs
+++ b/src/libcollections/lru_cache.rs
@@ -205,20 +205,20 @@ impl<A: fmt::Show + Hash + TotalEq, B: fmt::Show> fmt::Show for LruCache<A, B> {
     /// Return a string that lists the key-value pairs from most-recently
     /// used to least-recently used.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, r"\{"));
+        try!(write!(f, r"\{"));
         let mut cur = self.head;
         for i in range(0, self.len()) {
-            if i > 0 { try!(write!(f.buf, ", ")) }
+            if i > 0 { try!(write!(f, ", ")) }
             unsafe {
                 cur = (*cur).next;
-                try!(write!(f.buf, "{}", (*cur).key));
+                try!(write!(f, "{}", (*cur).key));
             }
-            try!(write!(f.buf, ": "));
+            try!(write!(f, ": "));
             unsafe {
-                try!(write!(f.buf, "{}", (*cur).value));
+                try!(write!(f, "{}", (*cur).value));
             }
         }
-        write!(f.buf, r"\}")
+        write!(f, r"\}")
     }
 }
 
diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs
index efd6732f653..2c6b0af8d94 100644
--- a/src/libcore/prelude.rs
+++ b/src/libcore/prelude.rs
@@ -35,7 +35,7 @@ pub use iter::{FromIterator, Extendable};
 pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
 pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
 pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
-pub use num::{Signed, Unsigned};
+pub use num::{Signed, Unsigned, Float};
 pub use num::{Primitive, Int, ToPrimitive, FromPrimitive};
 pub use ptr::RawPtr;
 pub use str::{Str, StrSlice};
diff --git a/src/libgreen/macros.rs b/src/libgreen/macros.rs
index 34e29b06f76..1921eef9f60 100644
--- a/src/libgreen/macros.rs
+++ b/src/libgreen/macros.rs
@@ -51,11 +51,9 @@ macro_rules! rtabort (
 )
 
 pub fn dumb_println(args: &fmt::Arguments) {
-    use std::io;
     use std::rt;
-
     let mut w = rt::Stderr;
-    let _ = fmt::writeln(&mut w as &mut io::Writer, args);
+    let _ = writeln!(&mut w, "{}", args);
 }
 
 pub fn abort(msg: &str) -> ! {
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs
index 9dd87a38fb6..5981f87b4f2 100644
--- a/src/liblog/lib.rs
+++ b/src/liblog/lib.rs
@@ -188,7 +188,7 @@ impl fmt::Show for LogLevel {
 impl fmt::Signed for LogLevel {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let LogLevel(level) = *self;
-        write!(fmt.buf, "{}", level)
+        write!(fmt, "{}", level)
     }
 }
 
diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs
index 9f66f767f20..ecc48d5569c 100644
--- a/src/libnum/bigint.rs
+++ b/src/libnum/bigint.rs
@@ -120,7 +120,7 @@ impl Default for BigUint {
 
 impl fmt::Show for BigUint {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.to_str_radix(10))
+        write!(f, "{}", self.to_str_radix(10))
     }
 }
 
@@ -843,7 +843,7 @@ impl Default for BigInt {
 
 impl fmt::Show for BigInt {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.to_str_radix(10))
+        write!(f, "{}", self.to_str_radix(10))
     }
 }
 
diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs
index 2fc46628616..3bc2408188d 100644
--- a/src/libnum/complex.rs
+++ b/src/libnum/complex.rs
@@ -171,9 +171,9 @@ impl<T: Clone + Num> One for Complex<T> {
 impl<T: fmt::Show + Num + Ord> fmt::Show for Complex<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         if self.im < Zero::zero() {
-            write!(f.buf, "{}-{}i", self.re, -self.im)
+            write!(f, "{}-{}i", self.re, -self.im)
         } else {
-            write!(f.buf, "{}+{}i", self.re, self.im)
+            write!(f, "{}+{}i", self.re, self.im)
         }
     }
 }
diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs
index bffca79f351..cd5c82acf6e 100644
--- a/src/libnum/rational.rs
+++ b/src/libnum/rational.rs
@@ -276,7 +276,7 @@ impl<T: Clone + Integer + Ord>
 impl<T: fmt::Show> fmt::Show for Ratio<T> {
     /// Renders as `numer/denom`.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}/{}", self.numer, self.denom)
+        write!(f, "{}/{}", self.numer, self.denom)
     }
 }
 impl<T: ToStrRadix> ToStrRadix for Ratio<T> {
diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs
index d1a01cc974f..a695da9fa16 100644
--- a/src/libregex/parse.rs
+++ b/src/libregex/parse.rs
@@ -37,7 +37,7 @@ pub struct Error {
 
 impl fmt::Show for Error {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "Regex syntax error near position {}: {}",
+        write!(f, "Regex syntax error near position {}: {}",
                self.pos, self.msg)
     }
 }
diff --git a/src/libregex/re.rs b/src/libregex/re.rs
index f22889b22a3..899c54d601b 100644
--- a/src/libregex/re.rs
+++ b/src/libregex/re.rs
@@ -117,7 +117,7 @@ pub struct Regex {
 impl fmt::Show for Regex {
     /// Shows the original regular expression.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.original)
+        write!(f, "{}", self.original)
     }
 }
 
diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs
index 49b5d7b2864..c885fc49de2 100644
--- a/src/librustc/metadata/tyencode.rs
+++ b/src/librustc/metadata/tyencode.rs
@@ -15,9 +15,7 @@
 
 use std::cell::RefCell;
 use collections::HashMap;
-use std::io;
 use std::io::MemWriter;
-use std::fmt;
 
 use middle::ty::param_ty;
 use middle::ty;
@@ -28,9 +26,7 @@ use syntax::ast::*;
 use syntax::diagnostic::SpanHandler;
 use syntax::parse::token;
 
-macro_rules! mywrite( ($wr:expr, $($arg:tt)*) => (
-    format_args!(|a| { mywrite($wr, a) }, $($arg)*)
-) )
+macro_rules! mywrite( ($($arg:tt)*) => ({ write!($($arg)*); }) )
 
 pub struct ctxt<'a> {
     pub diag: &'a SpanHandler,
@@ -52,10 +48,6 @@ pub struct ty_abbrev {
 
 pub type abbrev_map = RefCell<HashMap<ty::t, ty_abbrev>>;
 
-fn mywrite(w: &mut MemWriter, fmt: &fmt::Arguments) {
-    fmt::write(&mut *w as &mut io::Writer, fmt);
-}
-
 pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) {
     match cx.abbrevs.borrow_mut().find(&t) {
         Some(a) => { w.write(a.s.as_bytes()); return; }
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 02599d7a368..1954c6d4123 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -183,13 +183,13 @@ pub fn check_crate(tcx: &ty::ctxt,
 
 impl fmt::Show for LiveNode {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "ln({})", self.get())
+        write!(f, "ln({})", self.get())
     }
 }
 
 impl fmt::Show for Variable {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "v({})", self.get())
+        write!(f, "v({})", self.get())
     }
 }
 
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 2ae925caab5..517be1bde2f 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -388,7 +388,7 @@ pub struct t { inner: *t_opaque }
 
 impl fmt::Show for t {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.buf.write_str("*t_opaque")
+        "*t_opaque".fmt(f)
     }
 }
 
@@ -912,7 +912,7 @@ impl Vid for TyVid {
 
 impl fmt::Show for TyVid {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
-        write!(f.buf, "<generic \\#{}>", self.to_uint())
+        write!(f, "<generic \\#{}>", self.to_uint())
     }
 }
 
@@ -922,7 +922,7 @@ impl Vid for IntVid {
 
 impl fmt::Show for IntVid {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "<generic integer \\#{}>", self.to_uint())
+        write!(f, "<generic integer \\#{}>", self.to_uint())
     }
 }
 
@@ -932,7 +932,7 @@ impl Vid for FloatVid {
 
 impl fmt::Show for FloatVid {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "<generic float \\#{}>", self.to_uint())
+        write!(f, "<generic float \\#{}>", self.to_uint())
     }
 }
 
@@ -949,7 +949,7 @@ impl fmt::Show for RegionVid {
 impl fmt::Show for FnSig {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         // grr, without tcx not much we can do.
-        write!(f.buf, "(...)")
+        write!(f, "(...)")
     }
 }
 
@@ -1987,7 +1987,7 @@ impl ops::Sub<TypeContents,TypeContents> for TypeContents {
 
 impl fmt::Show for TypeContents {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "TypeContents({:t})", self.bits)
+        write!(f, "TypeContents({:t})", self.bits)
     }
 }
 
diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs
index f2f86485b19..42850f88763 100644
--- a/src/librustc/middle/typeck/variance.rs
+++ b/src/librustc/middle/typeck/variance.rs
@@ -240,9 +240,9 @@ enum VarianceTerm<'a> {
 impl<'a> fmt::Show for VarianceTerm<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
-            ConstantTerm(c1) => write!(f.buf, "{}", c1),
-            TransformTerm(v1, v2) => write!(f.buf, "({} \u00D7 {})", v1, v2),
-            InferredTerm(id) => write!(f.buf, "[{}]", { let InferredIndex(i) = id; i })
+            ConstantTerm(c1) => write!(f, "{}", c1),
+            TransformTerm(v1, v2) => write!(f, "({} \u00D7 {})", v1, v2),
+            InferredTerm(id) => write!(f, "[{}]", { let InferredIndex(i) = id; i })
         }
     }
 }
diff --git a/src/librustdoc/html/escape.rs b/src/librustdoc/html/escape.rs
index 60fcbe33a1b..fe93dbbc081 100644
--- a/src/librustdoc/html/escape.rs
+++ b/src/librustdoc/html/escape.rs
@@ -29,7 +29,7 @@ impl<'a> fmt::Show for Escape<'a> {
         for (i, ch) in s.bytes().enumerate() {
             match ch as char {
                 '<' | '>' | '&' | '\'' | '"' => {
-                    try!(fmt.buf.write(pile_o_bits.slice(last, i).as_bytes()));
+                    try!(fmt.write(pile_o_bits.slice(last, i).as_bytes()));
                     let s = match ch as char {
                         '>' => "&gt;",
                         '<' => "&lt;",
@@ -38,7 +38,7 @@ impl<'a> fmt::Show for Escape<'a> {
                         '"' => "&quot;",
                         _ => unreachable!()
                     };
-                    try!(fmt.buf.write(s.as_bytes()));
+                    try!(fmt.write(s.as_bytes()));
                     last = i + 1;
                 }
                 _ => {}
@@ -46,7 +46,7 @@ impl<'a> fmt::Show for Escape<'a> {
         }
 
         if last < s.len() {
-            try!(fmt.buf.write(pile_o_bits.slice_from(last).as_bytes()));
+            try!(fmt.write(pile_o_bits.slice_from(last).as_bytes()));
         }
         Ok(())
     }
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 342b96ba82f..7b802197615 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -16,7 +16,6 @@
 //! them in the future to instead emit any format desired.
 
 use std::fmt;
-use std::io;
 use std::strbuf::StrBuf;
 
 use syntax::ast;
@@ -52,46 +51,46 @@ impl FnStyleSpace {
 impl fmt::Show for clean::Generics {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         if self.lifetimes.len() == 0 && self.type_params.len() == 0 { return Ok(()) }
-        try!(f.buf.write("&lt;".as_bytes()));
+        try!(f.write("&lt;".as_bytes()));
 
         for (i, life) in self.lifetimes.iter().enumerate() {
             if i > 0 {
-                try!(f.buf.write(", ".as_bytes()));
+                try!(f.write(", ".as_bytes()));
             }
-            try!(write!(f.buf, "{}", *life));
+            try!(write!(f, "{}", *life));
         }
 
         if self.type_params.len() > 0 {
             if self.lifetimes.len() > 0 {
-                try!(f.buf.write(", ".as_bytes()));
+                try!(f.write(", ".as_bytes()));
             }
 
             for (i, tp) in self.type_params.iter().enumerate() {
                 if i > 0 {
-                    try!(f.buf.write(", ".as_bytes()))
+                    try!(f.write(", ".as_bytes()))
                 }
-                try!(f.buf.write(tp.name.as_bytes()));
+                try!(f.write(tp.name.as_bytes()));
 
                 if tp.bounds.len() > 0 {
-                    try!(f.buf.write(": ".as_bytes()));
+                    try!(f.write(": ".as_bytes()));
                     for (i, bound) in tp.bounds.iter().enumerate() {
                         if i > 0 {
-                            try!(f.buf.write(" + ".as_bytes()));
+                            try!(f.write(" + ".as_bytes()));
                         }
-                        try!(write!(f.buf, "{}", *bound));
+                        try!(write!(f, "{}", *bound));
                     }
                 }
             }
         }
-        try!(f.buf.write("&gt;".as_bytes()));
+        try!(f.write("&gt;".as_bytes()));
         Ok(())
     }
 }
 
 impl fmt::Show for clean::Lifetime {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(f.buf.write("'".as_bytes()));
-        try!(f.buf.write(self.get_ref().as_bytes()));
+        try!(f.write("'".as_bytes()));
+        try!(f.write(self.get_ref().as_bytes()));
         Ok(())
     }
 }
@@ -100,10 +99,10 @@ impl fmt::Show for clean::TyParamBound {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             clean::RegionBound => {
-                f.buf.write("'static".as_bytes())
+                f.write("::".as_bytes())
             }
             clean::TraitBound(ref ty) => {
-                write!(f.buf, "{}", *ty)
+                write!(f, "{}", *ty)
             }
         }
     }
@@ -112,32 +111,33 @@ impl fmt::Show for clean::TyParamBound {
 impl fmt::Show for clean::Path {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         if self.global {
-            try!(f.buf.write("::".as_bytes()))
+            try!(f.write("::".as_bytes()))
         }
+
         for (i, seg) in self.segments.iter().enumerate() {
             if i > 0 {
-                try!(f.buf.write("::".as_bytes()))
+                try!(f.write("::".as_bytes()))
             }
-            try!(f.buf.write(seg.name.as_bytes()));
+            try!(f.write(seg.name.as_bytes()));
 
             if seg.lifetimes.len() > 0 || seg.types.len() > 0 {
-                try!(f.buf.write("&lt;".as_bytes()));
+                try!(f.write("&lt;".as_bytes()));
                 let mut comma = false;
                 for lifetime in seg.lifetimes.iter() {
                     if comma {
-                        try!(f.buf.write(", ".as_bytes()));
+                        try!(f.write(", ".as_bytes()));
                     }
                     comma = true;
-                    try!(write!(f.buf, "{}", *lifetime));
+                    try!(write!(f, "{}", *lifetime));
                 }
                 for ty in seg.types.iter() {
                     if comma {
-                        try!(f.buf.write(", ".as_bytes()));
+                        try!(f.write(", ".as_bytes()));
                     }
                     comma = true;
-                    try!(write!(f.buf, "{}", *ty));
+                    try!(write!(f, "{}", *ty));
                 }
-                try!(f.buf.write("&gt;".as_bytes()));
+                try!(f.write("&gt;".as_bytes()));
             }
         }
         Ok(())
@@ -146,7 +146,7 @@ impl fmt::Show for clean::Path {
 
 /// Used when rendering a `ResolvedPath` structure. This invokes the `path`
 /// rendering function with the necessary arguments for linking to a local path.
-fn resolved_path(w: &mut io::Writer, did: ast::DefId, p: &clean::Path,
+fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, p: &clean::Path,
                  print_all: bool) -> fmt::Result {
     path(w, p, print_all,
         |cache, loc| {
@@ -170,7 +170,7 @@ fn resolved_path(w: &mut io::Writer, did: ast::DefId, p: &clean::Path,
         })
 }
 
-fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
+fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool,
         root: |&render::Cache, &[StrBuf]| -> Option<StrBuf>,
         info: |&render::Cache| -> Option<(Vec<StrBuf> , ItemType)>)
     -> fmt::Result
@@ -264,7 +264,7 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
 }
 
 /// Helper to render type parameters
-fn tybounds(w: &mut io::Writer,
+fn tybounds(w: &mut fmt::Formatter,
             typarams: &Option<Vec<clean::TyParamBound> >) -> fmt::Result {
     match *typarams {
         Some(ref params) => {
@@ -286,13 +286,13 @@ impl fmt::Show for clean::Type {
         match *self {
             clean::TyParamBinder(id) | clean::Generic(id) => {
                 let m = cache_key.get().unwrap();
-                f.buf.write(m.typarams.get(&id).as_bytes())
+                f.write(m.typarams.get(&id).as_bytes())
             }
             clean::ResolvedPath{ did, ref typarams, ref path} => {
-                try!(resolved_path(f.buf, did, path, false));
+                try!(resolved_path(f, did, path, false));
                 tybounds(f.buf, typarams)
             }
-            clean::Self(..) => f.buf.write("Self".as_bytes()),
+            clean::Self(..) => f.write("Self".as_bytes()),
             clean::Primitive(prim) => {
                 let s = match prim {
                     ast::TyInt(ast::TyI) => "int",
@@ -312,11 +312,11 @@ impl fmt::Show for clean::Type {
                     ast::TyBool => "bool",
                     ast::TyChar => "char",
                 };
-                f.buf.write(s.as_bytes())
+                f.write(s.as_bytes())
             }
             clean::Closure(ref decl, ref region) => {
-                write!(f.buf, "{style}{lifetimes}|{args}|{bounds}\
-                               {arrow, select, yes{ -&gt; {ret}} other{}}",
+                write!(f, "{style}{lifetimes}|{args}|{bounds}\
+                           {arrow, select, yes{ -&gt; {ret}} other{}}",
                        style = FnStyleSpace(decl.fn_style),
                        lifetimes = if decl.lifetimes.len() == 0 {
                            "".to_owned()
@@ -351,8 +351,8 @@ impl fmt::Show for clean::Type {
                        })
             }
             clean::Proc(ref decl) => {
-                write!(f.buf, "{style}{lifetimes}proc({args}){bounds}\
-                               {arrow, select, yes{ -&gt; {ret}} other{}}",
+                write!(f, "{style}{lifetimes}proc({args}){bounds}\
+                           {arrow, select, yes{ -&gt; {ret}} other{}}",
                        style = FnStyleSpace(decl.fn_style),
                        lifetimes = if decl.lifetimes.len() == 0 {
                            "".to_strbuf()
@@ -374,7 +374,7 @@ impl fmt::Show for clean::Type {
                        ret = decl.decl.output)
             }
             clean::BareFunction(ref decl) => {
-                write!(f.buf, "{}{}fn{}{}",
+                write!(f, "{}{}fn{}{}",
                        FnStyleSpace(decl.fn_style),
                        match decl.abi.as_slice() {
                            "" => " extern ".to_strbuf(),
@@ -385,27 +385,27 @@ impl fmt::Show for clean::Type {
                        decl.decl)
             }
             clean::Tuple(ref typs) => {
-                try!(f.buf.write("(".as_bytes()));
+                try!(f.write("(".as_bytes()));
                 for (i, typ) in typs.iter().enumerate() {
                     if i > 0 {
-                        try!(f.buf.write(", ".as_bytes()))
+                        try!(f.write(", ".as_bytes()))
                     }
-                    try!(write!(f.buf, "{}", *typ));
+                    try!(write!(f, "{}", *typ));
                 }
-                f.buf.write(")".as_bytes())
+                f.write(")".as_bytes())
             }
-            clean::Vector(ref t) => write!(f.buf, "[{}]", **t),
+            clean::Vector(ref t) => write!(f, "[{}]", **t),
             clean::FixedVector(ref t, ref s) => {
-                write!(f.buf, "[{}, ..{}]", **t, *s)
-            }
-            clean::String => f.buf.write("str".as_bytes()),
-            clean::Bool => f.buf.write("bool".as_bytes()),
-            clean::Unit => f.buf.write("()".as_bytes()),
-            clean::Bottom => f.buf.write("!".as_bytes()),
-            clean::Unique(ref t) => write!(f.buf, "~{}", **t),
-            clean::Managed(ref t) => write!(f.buf, "@{}", **t),
+                write!(f, "[{}, ..{}]", **t, *s)
+            }
+            clean::String => f.write("str".as_bytes()),
+            clean::Bool => f.write("bool".as_bytes()),
+            clean::Unit => f.write("()".as_bytes()),
+            clean::Bottom => f.write("!".as_bytes()),
+            clean::Unique(ref t) => write!(f, "~{}", **t),
+            clean::Managed(ref t) => write!(f, "@{}", **t),
             clean::RawPointer(m, ref t) => {
-                write!(f.buf, "*{}{}",
+                write!(f, "*{}{}",
                        match m {
                            clean::Mutable => "mut ",
                            clean::Immutable => "",
@@ -413,7 +413,7 @@ impl fmt::Show for clean::Type {
             }
             clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => {
                 let lt = match *l { Some(ref l) => format!("{} ", *l), _ => "".to_owned() };
-                write!(f.buf, "&amp;{}{}{}",
+                write!(f, "&amp;{}{}{}",
                        lt,
                        match mutability {
                            clean::Mutable => "mut ",
@@ -428,11 +428,11 @@ impl fmt::Show for clean::Type {
 impl fmt::Show for clean::Arguments {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         for (i, input) in self.values.iter().enumerate() {
-            if i > 0 { try!(write!(f.buf, ", ")); }
+            if i > 0 { try!(write!(f, ", ")); }
             if input.name.len() > 0 {
-                try!(write!(f.buf, "{}: ", input.name));
+                try!(write!(f, "{}: ", input.name));
             }
-            try!(write!(f.buf, "{}", input.type_));
+            try!(write!(f, "{}", input.type_));
         }
         Ok(())
     }
@@ -440,7 +440,7 @@ impl fmt::Show for clean::Arguments {
 
 impl fmt::Show for clean::FnDecl {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "({args}){arrow, select, yes{ -&gt; {ret}} other{}}",
+        write!(f, "({args}){arrow, select, yes{ -&gt; {ret}} other{}}",
                args = self.inputs,
                arrow = match self.output { clean::Unit => "no", _ => "yes" },
                ret = self.output)
@@ -475,7 +475,7 @@ impl<'a> fmt::Show for Method<'a> {
             }
             args.push_str(format!("{}", input.type_));
         }
-        write!(f.buf,
+        write!(f,
                "({args}){arrow, select, yes{ -&gt; {ret}} other{}}",
                args = args,
                arrow = match d.output { clean::Unit => "no", _ => "yes" },
@@ -486,7 +486,7 @@ impl<'a> fmt::Show for Method<'a> {
 impl fmt::Show for VisSpace {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self.get() {
-            Some(ast::Public) => write!(f.buf, "pub "),
+            Some(ast::Public) => write!(f, "pub "),
             Some(ast::Inherited) | None => Ok(())
         }
     }
@@ -495,7 +495,7 @@ impl fmt::Show for VisSpace {
 impl fmt::Show for FnStyleSpace {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self.get() {
-            ast::UnsafeFn => write!(f.buf, "unsafe "),
+            ast::UnsafeFn => write!(f, "unsafe "),
             ast::NormalFn => Ok(())
         }
     }
@@ -506,23 +506,23 @@ impl fmt::Show for clean::ViewPath {
         match *self {
             clean::SimpleImport(ref name, ref src) => {
                 if *name == src.path.segments.last().unwrap().name {
-                    write!(f.buf, "use {};", *src)
+                    write!(f, "use {};", *src)
                 } else {
-                    write!(f.buf, "use {} = {};", *name, *src)
+                    write!(f, "use {} = {};", *name, *src)
                 }
             }
             clean::GlobImport(ref src) => {
-                write!(f.buf, "use {}::*;", *src)
+                write!(f, "use {}::*;", *src)
             }
             clean::ImportList(ref src, ref names) => {
-                try!(write!(f.buf, "use {}::\\{", *src));
+                try!(write!(f, "use {}::\\{", *src));
                 for (i, n) in names.iter().enumerate() {
                     if i > 0 {
-                        try!(write!(f.buf, ", "));
+                        try!(write!(f, ", "));
                     }
-                    try!(write!(f.buf, "{}", *n));
+                    try!(write!(f, "{}", *n));
                 }
-                write!(f.buf, "\\};")
+                write!(f, "\\};")
             }
         }
     }
@@ -531,13 +531,13 @@ impl fmt::Show for clean::ViewPath {
 impl fmt::Show for clean::ImportSource {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self.did {
-            Some(did) => resolved_path(f.buf, did, &self.path, true),
+            Some(did) => resolved_path(f, did, &self.path, true),
             _ => {
                 for (i, seg) in self.path.segments.iter().enumerate() {
                     if i > 0 {
-                        try!(write!(f.buf, "::"))
+                        try!(write!(f, "::"))
                     }
-                    try!(write!(f.buf, "{}", seg.name));
+                    try!(write!(f, "{}", seg.name));
                 }
                 Ok(())
             }
@@ -557,9 +557,9 @@ impl fmt::Show for clean::ViewListIdent {
                         types: Vec::new(),
                     })
                 };
-                resolved_path(f.buf, did, &path, false)
+                resolved_path(f, did, &path, false)
             }
-            _ => write!(f.buf, "{}", self.name),
+            _ => write!(f, "{}", self.name),
         }
     }
 }
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index e667f7a57f1..dd465df1db7 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -26,7 +26,7 @@ pub struct Page<'a> {
 
 pub fn render<T: fmt::Show, S: fmt::Show>(
     dst: &mut io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T)
-    -> fmt::Result
+    -> io::IoResult<()>
 {
     write!(dst,
 r##"<!DOCTYPE html>
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index d6831e225bc..b64e77615e1 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -29,7 +29,6 @@
 use libc;
 use std::cell::RefCell;
 use std::fmt;
-use std::io;
 use std::slice;
 use std::str;
 use collections::HashMap;
@@ -141,7 +140,7 @@ fn stripped_filtered_line<'a>(s: &'a str) -> Option<&'a str> {
 
 local_data_key!(used_header_map: RefCell<HashMap<StrBuf, uint>>)
 
-pub fn render(w: &mut io::Writer, s: &str, print_toc: bool) -> fmt::Result {
+pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
     extern fn block(ob: *mut hoedown_buffer, text: *hoedown_buffer,
                     lang: *hoedown_buffer, opaque: *mut libc::c_void) {
         unsafe {
@@ -355,13 +354,13 @@ impl<'a> fmt::Show for Markdown<'a> {
         let Markdown(md) = *self;
         // This is actually common enough to special-case
         if md.len() == 0 { return Ok(()) }
-        render(fmt.buf, md.as_slice(), false)
+        render(fmt, md.as_slice(), false)
     }
 }
 
 impl<'a> fmt::Show for MarkdownWithToc<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let MarkdownWithToc(md) = *self;
-        render(fmt.buf, md.as_slice(), true)
+        render(fmt, md.as_slice(), true)
     }
 }
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 0883d25770e..8ae29d7d273 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -587,7 +587,7 @@ impl<'a> SourceCollector<'a> {
             root_path: root_path.as_slice(),
         };
         try!(layout::render(&mut w as &mut Writer, &self.cx.layout,
-                              &page, &(""), &Source(contents)));
+                            &page, &(""), &Source(contents)));
         try!(w.flush());
         return Ok(());
     }
@@ -925,8 +925,8 @@ impl Context {
             // write sycall all the time.
             let mut writer = BufferedWriter::new(w);
             try!(layout::render(&mut writer as &mut Writer, &cx.layout, &page,
-                                  &Sidebar{ cx: cx, item: it },
-                                  &Item{ cx: cx, item: it }));
+                                &Sidebar{ cx: cx, item: it },
+                                &Item{ cx: cx, item: it }));
             writer.flush()
         }
 
@@ -997,17 +997,17 @@ impl<'a> Item<'a> {
 impl<'a> fmt::Show for Item<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         // Write the breadcrumb trail header for the top
-        try!(write!(fmt.buf, "\n<h1 class='fqn'>"));
+        try!(write!(fmt, "\n<h1 class='fqn'>"));
         match self.item.inner {
             clean::ModuleItem(ref m) => if m.is_crate {
-                    try!(write!(fmt.buf, "Crate "));
+                    try!(write!(fmt, "Crate "));
                 } else {
-                    try!(write!(fmt.buf, "Module "));
+                    try!(write!(fmt, "Module "));
                 },
-            clean::FunctionItem(..) => try!(write!(fmt.buf, "Function ")),
-            clean::TraitItem(..) => try!(write!(fmt.buf, "Trait ")),
-            clean::StructItem(..) => try!(write!(fmt.buf, "Struct ")),
-            clean::EnumItem(..) => try!(write!(fmt.buf, "Enum ")),
+            clean::FunctionItem(..) => try!(write!(fmt, "Function ")),
+            clean::TraitItem(..) => try!(write!(fmt, "Trait ")),
+            clean::StructItem(..) => try!(write!(fmt, "Struct ")),
+            clean::EnumItem(..) => try!(write!(fmt, "Enum ")),
             _ => {}
         }
         let cur = self.cx.current.as_slice();
@@ -1017,16 +1017,16 @@ impl<'a> fmt::Show for Item<'a> {
             for _ in range(0, cur.len() - i - 1) {
                 trail.push_str("../");
             }
-            try!(write!(fmt.buf, "<a href='{}index.html'>{}</a>::",
-                          trail, component.as_slice()));
+            try!(write!(fmt, "<a href='{}index.html'>{}</a>::",
+                        trail, component.as_slice()));
         }
-        try!(write!(fmt.buf, "<a class='{}' href=''>{}</a>",
-                      shortty(self.item), self.item.name.get_ref().as_slice()));
+        try!(write!(fmt, "<a class='{}' href=''>{}</a>",
+                    shortty(self.item), self.item.name.get_ref().as_slice()));
 
         // Write stability attributes
         match attr::find_stability(self.item.attrs.iter()) {
             Some(ref stability) => {
-                try!(write!(fmt.buf,
+                try!(write!(fmt,
                        "<a class='stability {lvl}' title='{reason}'>{lvl}</a>",
                        lvl = stability.level.to_str(),
                        reason = match stability.text {
@@ -1039,22 +1039,22 @@ impl<'a> fmt::Show for Item<'a> {
 
         // Write `src` tag
         if self.cx.include_sources {
-            try!(write!(fmt.buf, "<a class='source' href='{}'>[src]</a>",
+            try!(write!(fmt, "<a class='source' href='{}'>[src]</a>",
                         self.link()));
         }
-        try!(write!(fmt.buf, "</h1>\n"));
+        try!(write!(fmt, "</h1>\n"));
 
         match self.item.inner {
             clean::ModuleItem(ref m) => {
-                item_module(fmt.buf, self.cx, self.item, m.items.as_slice())
+                item_module(fmt, self.cx, self.item, m.items.as_slice())
             }
             clean::FunctionItem(ref f) | clean::ForeignFunctionItem(ref f) =>
-                item_function(fmt.buf, self.item, f),
-            clean::TraitItem(ref t) => item_trait(fmt.buf, self.item, t),
-            clean::StructItem(ref s) => item_struct(fmt.buf, self.item, s),
-            clean::EnumItem(ref e) => item_enum(fmt.buf, self.item, e),
-            clean::TypedefItem(ref t) => item_typedef(fmt.buf, self.item, t),
-            clean::MacroItem(ref m) => item_macro(fmt.buf, self.item, m),
+                item_function(fmt, self.item, f),
+            clean::TraitItem(ref t) => item_trait(fmt, self.item, t),
+            clean::StructItem(ref s) => item_struct(fmt, self.item, s),
+            clean::EnumItem(ref e) => item_enum(fmt, self.item, e),
+            clean::TypedefItem(ref t) => item_typedef(fmt, self.item, t),
+            clean::MacroItem(ref m) => item_macro(fmt, self.item, m),
             _ => Ok(())
         }
     }
@@ -1097,7 +1097,7 @@ fn shorter<'a>(s: Option<&'a str>) -> &'a str {
     }
 }
 
-fn document(w: &mut Writer, item: &clean::Item) -> fmt::Result {
+fn document(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::Result {
     match item.doc_value() {
         Some(s) => {
             try!(write!(w, "<div class='docblock'>{}</div>", Markdown(s)));
@@ -1107,7 +1107,7 @@ fn document(w: &mut Writer, item: &clean::Item) -> fmt::Result {
     Ok(())
 }
 
-fn item_module(w: &mut Writer, cx: &Context,
+fn item_module(w: &mut fmt::Formatter, cx: &Context,
                item: &clean::Item, items: &[clean::Item]) -> fmt::Result {
     try!(document(w, item));
     debug!("{:?}", items);
@@ -1196,13 +1196,12 @@ fn item_module(w: &mut Writer, cx: &Context,
                     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                         let Initializer(s, item) = *self;
                         if s.len() == 0 { return Ok(()); }
-                        try!(write!(f.buf, "<code> = </code>"));
+                        try!(write!(f, "<code> = </code>"));
                         if s.contains("\n") {
-                            write!(f.buf,
-                                   "<a href='{}'>[definition]</a>",
+                            write!(f, "<a href='{}'>[definition]</a>",
                                    item.link())
                         } else {
-                            write!(f.buf, "<code>{}</code>", s.as_slice())
+                            write!(f, "<code>{}</code>", s.as_slice())
                         }
                     }
                 }
@@ -1262,7 +1261,7 @@ fn item_module(w: &mut Writer, cx: &Context,
     write!(w, "</table>")
 }
 
-fn item_function(w: &mut Writer, it: &clean::Item,
+fn item_function(w: &mut fmt::Formatter, it: &clean::Item,
                  f: &clean::Function) -> fmt::Result {
     try!(write!(w, "<pre class='rust fn'>{vis}{fn_style}fn \
                     {name}{generics}{decl}</pre>",
@@ -1274,7 +1273,7 @@ fn item_function(w: &mut Writer, it: &clean::Item,
     document(w, it)
 }
 
-fn item_trait(w: &mut Writer, it: &clean::Item,
+fn item_trait(w: &mut fmt::Formatter, it: &clean::Item,
               t: &clean::Trait) -> fmt::Result {
     let mut parents = StrBuf::new();
     if t.parents.len() > 0 {
@@ -1318,7 +1317,7 @@ fn item_trait(w: &mut Writer, it: &clean::Item,
     // Trait documentation
     try!(document(w, it));
 
-    fn meth(w: &mut Writer, m: &clean::TraitMethod) -> fmt::Result {
+    fn meth(w: &mut fmt::Formatter, m: &clean::TraitMethod) -> fmt::Result {
         try!(write!(w, "<h3 id='{}.{}' class='method'><code>",
                       shortty(m.item()),
                       *m.item().name.get_ref()));
@@ -1374,8 +1373,8 @@ fn item_trait(w: &mut Writer, it: &clean::Item,
     Ok(())
 }
 
-fn render_method(w: &mut Writer, meth: &clean::Item) -> fmt::Result {
-    fn fun(w: &mut Writer, it: &clean::Item, fn_style: ast::FnStyle,
+fn render_method(w: &mut fmt::Formatter, meth: &clean::Item) -> fmt::Result {
+    fn fun(w: &mut fmt::Formatter, it: &clean::Item, fn_style: ast::FnStyle,
            g: &clean::Generics, selfty: &clean::SelfTy,
            d: &clean::FnDecl) -> fmt::Result {
         write!(w, "{}fn <a href='\\#{ty}.{name}' class='fnname'>{name}</a>\
@@ -1400,7 +1399,7 @@ fn render_method(w: &mut Writer, meth: &clean::Item) -> fmt::Result {
     }
 }
 
-fn item_struct(w: &mut Writer, it: &clean::Item,
+fn item_struct(w: &mut fmt::Formatter, it: &clean::Item,
                s: &clean::Struct) -> fmt::Result {
     try!(write!(w, "<pre class='rust struct'>"));
     try!(render_struct(w,
@@ -1437,7 +1436,8 @@ fn item_struct(w: &mut Writer, it: &clean::Item,
     render_methods(w, it)
 }
 
-fn item_enum(w: &mut Writer, it: &clean::Item, e: &clean::Enum) -> fmt::Result {
+fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
+             e: &clean::Enum) -> fmt::Result {
     try!(write!(w, "<pre class='rust enum'>{}enum {}{}",
                   VisSpace(it.visibility),
                   it.name.get_ref().as_slice(),
@@ -1533,7 +1533,7 @@ fn item_enum(w: &mut Writer, it: &clean::Item, e: &clean::Enum) -> fmt::Result {
     Ok(())
 }
 
-fn render_struct(w: &mut Writer, it: &clean::Item,
+fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
                  g: Option<&clean::Generics>,
                  ty: doctree::StructType,
                  fields: &[clean::Item],
@@ -1597,7 +1597,7 @@ fn render_struct(w: &mut Writer, it: &clean::Item,
     Ok(())
 }
 
-fn render_methods(w: &mut Writer, it: &clean::Item) -> fmt::Result {
+fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
     match cache_key.get().unwrap().impls.find(&it.id) {
         Some(v) => {
             let mut non_trait = v.iter().filter(|p| {
@@ -1642,7 +1642,7 @@ fn render_methods(w: &mut Writer, it: &clean::Item) -> fmt::Result {
     Ok(())
 }
 
-fn render_impl(w: &mut Writer, i: &clean::Impl,
+fn render_impl(w: &mut fmt::Formatter, i: &clean::Impl,
                dox: &Option<StrBuf>) -> fmt::Result {
     try!(write!(w, "<h3 class='impl'><code>impl{} ", i.generics));
     let trait_id = match i.trait_ {
@@ -1664,8 +1664,8 @@ fn render_impl(w: &mut Writer, i: &clean::Impl,
         None => {}
     }
 
-    fn docmeth(w: &mut Writer, item: &clean::Item,
-               dox: bool) -> io::IoResult<()> {
+    fn docmeth(w: &mut fmt::Formatter, item: &clean::Item,
+               dox: bool) -> fmt::Result {
         try!(write!(w, "<h4 id='method.{}' class='method'><code>",
                       *item.name.get_ref()));
         try!(render_method(w, item));
@@ -1714,7 +1714,7 @@ fn render_impl(w: &mut Writer, i: &clean::Impl,
     Ok(())
 }
 
-fn item_typedef(w: &mut Writer, it: &clean::Item,
+fn item_typedef(w: &mut fmt::Formatter, it: &clean::Item,
                 t: &clean::Typedef) -> fmt::Result {
     try!(write!(w, "<pre class='rust typedef'>type {}{} = {};</pre>",
                   it.name.get_ref().as_slice(),
@@ -1728,21 +1728,21 @@ impl<'a> fmt::Show for Sidebar<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let cx = self.cx;
         let it = self.item;
-        try!(write!(fmt.buf, "<p class='location'>"));
+        try!(write!(fmt, "<p class='location'>"));
         let len = cx.current.len() - if it.is_mod() {1} else {0};
         for (i, name) in cx.current.iter().take(len).enumerate() {
             if i > 0 {
-                try!(write!(fmt.buf, "&\\#8203;::"));
+                try!(write!(fmt, "&\\#8203;::"));
             }
-            try!(write!(fmt.buf, "<a href='{}index.html'>{}</a>",
+            try!(write!(fmt, "<a href='{}index.html'>{}</a>",
                           cx.root_path
                             .as_slice()
                             .slice_to((cx.current.len() - i - 1) * 3),
                           *name));
         }
-        try!(write!(fmt.buf, "</p>"));
+        try!(write!(fmt, "</p>"));
 
-        fn block(w: &mut Writer, short: &str, longty: &str,
+        fn block(w: &mut fmt::Formatter, short: &str, longty: &str,
                  cur: &clean::Item, cx: &Context) -> fmt::Result {
             let items = match cx.sidebar.find_equiv(&short) {
                 Some(items) => items.as_slice(),
@@ -1770,12 +1770,12 @@ impl<'a> fmt::Show for Sidebar<'a> {
             Ok(())
         }
 
-        try!(block(fmt.buf, "mod", "Modules", it, cx));
-        try!(block(fmt.buf, "struct", "Structs", it, cx));
-        try!(block(fmt.buf, "enum", "Enums", it, cx));
-        try!(block(fmt.buf, "trait", "Traits", it, cx));
-        try!(block(fmt.buf, "fn", "Functions", it, cx));
-        try!(block(fmt.buf, "macro", "Macros", it, cx));
+        try!(block(fmt, "mod", "Modules", it, cx));
+        try!(block(fmt, "struct", "Structs", it, cx));
+        try!(block(fmt, "enum", "Enums", it, cx));
+        try!(block(fmt, "trait", "Traits", it, cx));
+        try!(block(fmt, "fn", "Functions", it, cx));
+        try!(block(fmt, "macro", "Macros", it, cx));
         Ok(())
     }
 }
@@ -1808,19 +1808,18 @@ impl<'a> fmt::Show for Source<'a> {
             cols += 1;
             tmp /= 10;
         }
-        try!(write!(fmt.buf, "<pre class='line-numbers'>"));
+        try!(write!(fmt, "<pre class='line-numbers'>"));
         for i in range(1, lines + 1) {
-            try!(write!(fmt.buf, "<span id='{0:u}'>{0:1$u}</span>\n", i, cols));
+            try!(write!(fmt, "<span id='{0:u}'>{0:1$u}</span>\n", i, cols));
         }
-        try!(write!(fmt.buf, "</pre>"));
-        try!(write!(fmt.buf, "{}", highlight::highlight(s.as_slice(), None)));
+        try!(write!(fmt, "</pre>"));
+        try!(write!(fmt, "{}", highlight::highlight(s.as_slice(), None)));
         Ok(())
     }
 }
 
-fn item_macro(w: &mut Writer, it: &clean::Item,
+fn item_macro(w: &mut fmt::Formatter, it: &clean::Item,
               t: &clean::Macro) -> fmt::Result {
-    try!(w.write_str(highlight::highlight(t.source.as_slice(),
-                                          Some("macro")).as_slice()));
+    try!(w.write(highlight::highlight(t.source.as_slice(), Some("macro")).as_bytes()));
     document(w, it)
 }
diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs
index 893214dc9c9..4dabdf64f81 100644
--- a/src/librustdoc/html/toc.rs
+++ b/src/librustdoc/html/toc.rs
@@ -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>")
     }
 }
 
diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs
index 53515ec58e5..141e3e515ac 100644
--- a/src/librustuv/lib.rs
+++ b/src/librustuv/lib.rs
@@ -379,7 +379,7 @@ impl UvError {
 
 impl fmt::Show for UvError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}: {}", self.name(), self.desc())
+        write!(f, "{}: {}", self.name(), self.desc())
     }
 }
 
diff --git a/src/librustuv/macros.rs b/src/librustuv/macros.rs
index 8e827703cb2..deb7036848f 100644
--- a/src/librustuv/macros.rs
+++ b/src/librustuv/macros.rs
@@ -28,9 +28,7 @@ macro_rules! uvdebug (
 )
 
 pub fn dumb_println(args: &fmt::Arguments) {
-    use std::io;
     use std::rt;
-
     let mut w = rt::Stderr;
-    let _ = fmt::writeln(&mut w as &mut io::Writer, args);
+    let _ = writeln!(&mut w, "{}", args);
 }
diff --git a/src/libsemver/lib.rs b/src/libsemver/lib.rs
index 3035b305617..2f1d59b23a2 100644
--- a/src/libsemver/lib.rs
+++ b/src/libsemver/lib.rs
@@ -96,18 +96,18 @@ pub struct Version {
 impl fmt::Show for Version {
     #[inline]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, "{}.{}.{}", self.major, self.minor, self.patch))
+        try!(write!(f, "{}.{}.{}", self.major, self.minor, self.patch))
         if !self.pre.is_empty() {
-            try!(write!(f.buf, "-"));
+            try!(write!(f, "-"));
             for (i, x) in self.pre.iter().enumerate() {
-                if i != 0 { try!(write!(f.buf, ".")) };
+                if i != 0 { try!(write!(f, ".")) };
                 try!(x.fmt(f));
             }
         }
         if !self.build.is_empty() {
-            try!(write!(f.buf, "+"));
+            try!(write!(f, "+"));
             for (i, x) in self.build.iter().enumerate() {
-                if i != 0 { try!(write!(f.buf, ".")) };
+                if i != 0 { try!(write!(f, ".")) };
                 try!(x.fmt(f));
             }
         }
diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs
index 5702557526f..5ed778b49eb 100644
--- a/src/libserialize/base64.rs
+++ b/src/libserialize/base64.rs
@@ -170,8 +170,8 @@ impl fmt::Show for FromBase64Error {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             InvalidBase64Character(ch, idx) =>
-                write!(f.buf, "Invalid character '{}' at position {}", ch, idx),
-            InvalidBase64Length => write!(f.buf, "Invalid length"),
+                write!(f, "Invalid character '{}' at position {}", ch, idx),
+            InvalidBase64Length => write!(f, "Invalid length"),
         }
     }
 }
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index 2b9ba763b2e..623bf85424a 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -69,8 +69,8 @@ impl fmt::Show for FromHexError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             InvalidHexCharacter(ch, idx) =>
-                write!(f.buf, "Invalid character '{}' at position {}", ch, idx),
-            InvalidHexLength => write!(f.buf, "Invalid input length"),
+                write!(f, "Invalid character '{}' at position {}", ch, idx),
+            InvalidHexLength => write!(f, "Invalid input length"),
         }
     }
 }
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index bf04f10fcf0..17a864d2862 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -2267,7 +2267,7 @@ impl<A:ToJson> ToJson for Option<A> {
 impl fmt::Show for Json {
     /// Encodes a json value into a string
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.to_writer(f.buf)
+        self.to_writer(f).map_err(|_| fmt::WriteError)
     }
 }
 
diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs
index 163ccd22552..6b393987281 100644
--- a/src/libstd/bitflags.rs
+++ b/src/libstd/bitflags.rs
@@ -59,7 +59,7 @@
 //!
 //! impl fmt::Show for Flags {
 //!     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-//!         write!(f.buf, "hi!")
+//!         write!(f, "hi!")
 //!     }
 //! }
 //!
diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs
index a14bf49a21f..c6885c6b4be 100644
--- a/src/libstd/fmt.rs
+++ b/src/libstd/fmt.rs
@@ -549,7 +549,7 @@ pub trait Poly {
 /// ```
 pub fn format(args: &Arguments) -> ~str {
     let mut output = io::MemWriter::new();
-    output.write_fmt(args).unwrap();
+    let _ = write!(&mut output, "{}", args);
     str::from_utf8(output.unwrap().as_slice()).unwrap().to_owned()
 }
 
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 68cbdd2e0aa..2880365cf34 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -16,7 +16,7 @@ use io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult};
 use iter::ExactSize;
 use ops::Drop;
 use option::{Some, None, Option};
-use result::{Ok, Err, ResultUnwrap};
+use result::{Ok, Err};
 use slice::{ImmutableVector, MutableVector};
 use slice;
 use vec::Vec;
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 497213df30f..a043722581b 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -381,9 +381,9 @@ impl IoError {
 
 impl fmt::Show for IoError {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        try!(fmt.buf.write_str(self.desc));
+        try!(write!(fmt, "{}", self.desc));
         match self.detail {
-            Some(ref s) => write!(fmt.buf, " ({})", *s),
+            Some(ref s) => write!(fmt, " ({})", *s),
             None => Ok(())
         }
     }
diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs
index 7621a7ec4cd..f469c419e8e 100644
--- a/src/libstd/io/net/ip.rs
+++ b/src/libstd/io/net/ip.rs
@@ -35,22 +35,22 @@ impl fmt::Show for IpAddr {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             Ipv4Addr(a, b, c, d) =>
-                write!(fmt.buf, "{}.{}.{}.{}", a, b, c, d),
+                write!(fmt, "{}.{}.{}.{}", a, b, c, d),
 
             // Ipv4 Compatible address
             Ipv6Addr(0, 0, 0, 0, 0, 0, g, h) => {
-                write!(fmt.buf, "::{}.{}.{}.{}", (g >> 8) as u8, g as u8,
+                write!(fmt, "::{}.{}.{}.{}", (g >> 8) as u8, g as u8,
                        (h >> 8) as u8, h as u8)
             }
 
             // Ipv4-Mapped address
             Ipv6Addr(0, 0, 0, 0, 0, 0xFFFF, g, h) => {
-                write!(fmt.buf, "::FFFF:{}.{}.{}.{}", (g >> 8) as u8, g as u8,
+                write!(fmt, "::FFFF:{}.{}.{}.{}", (g >> 8) as u8, g as u8,
                        (h >> 8) as u8, h as u8)
             }
 
             Ipv6Addr(a, b, c, d, e, f, g, h) =>
-                write!(fmt.buf, "{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}",
+                write!(fmt, "{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}",
                        a, b, c, d, e, f, g, h)
         }
     }
@@ -65,8 +65,8 @@ pub struct SocketAddr {
 impl fmt::Show for SocketAddr {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self.ip {
-            Ipv4Addr(..) => write!(f.buf, "{}:{}", self.ip, self.port),
-            Ipv6Addr(..) => write!(f.buf, "[{}]:{}", self.ip, self.port),
+            Ipv4Addr(..) => write!(f, "{}:{}", self.ip, self.port),
+            Ipv6Addr(..) => write!(f, "[{}]:{}", self.ip, self.port),
         }
     }
 }
diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs
index 864a7010541..875dd01be82 100644
--- a/src/libstd/io/net/udp.rs
+++ b/src/libstd/io/net/udp.rs
@@ -384,8 +384,6 @@ mod test {
     })
 
     pub fn socket_name(addr: SocketAddr) {
-        use result::ResultUnwrap;
-
         let server = UdpSocket::bind(addr);
 
         assert!(server.is_ok());
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index fe51615285a..88ed7e9c0d3 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -361,8 +361,8 @@ impl fmt::Show for ProcessExit {
     /// Format a ProcessExit enum, to nicely present the information.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
-            ExitStatus(code) =>  write!(f.buf, "exit code: {}", code),
-            ExitSignal(code) =>  write!(f.buf, "signal: {}", code),
+            ExitStatus(code) =>  write!(f, "exit code: {}", code),
+            ExitSignal(code) =>  write!(f, "signal: {}", code),
         }
     }
 }
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index 69ba0fb20ee..e6d416164d0 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -36,7 +36,7 @@ use mem::replace;
 use option::{Option, Some, None};
 use owned::Box;
 use prelude::drop;
-use result::{Ok, Err, ResultUnwrap};
+use result::{Ok, Err};
 use rt;
 use rt::local::Local;
 use rt::rtio::{DontClose, IoFactory, LocalIo, RtioFileStream, RtioTTY};
@@ -276,13 +276,13 @@ pub fn println(s: &str) {
 /// Similar to `print`, but takes a `fmt::Arguments` structure to be compatible
 /// with the `format_args!` macro.
 pub fn print_args(fmt: &fmt::Arguments) {
-    with_task_stdout(|io| fmt::write(io, fmt))
+    with_task_stdout(|io| write!(io, "{}", fmt))
 }
 
 /// Similar to `println`, but takes a `fmt::Arguments` structure to be
 /// compatible with the `format_args!` macro.
 pub fn println_args(fmt: &fmt::Arguments) {
-    with_task_stdout(|io| fmt::writeln(io, fmt))
+    with_task_stdout(|io| writeln!(io, "{}", fmt))
 }
 
 /// Representation of a reader of a standard input stream
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 063ee0d8215..b260f685a34 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -269,10 +269,9 @@ macro_rules! write(
 /// the message is written.
 #[macro_export]
 macro_rules! writeln(
-    ($dst:expr, $fmt:expr $($arg:tt)*) => ({
-        format_args!(|args| { $dst.write_fmt(args) },
-                     concat!($fmt, "\n") $($arg)*)
-    })
+    ($dst:expr, $fmt:expr $($arg:tt)*) => (
+        write!($dst, concat!($fmt, "\n") $($arg)*)
+    )
 )
 
 /// Equivalent to the `println!` macro except that a newline is not printed at
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index 63d6219ab8a..c2ec5c75fc1 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -820,7 +820,6 @@ mod bench {
         use super::test::Bencher;
         use rand::{XorShiftRng, Rng};
         use num::ToStrRadix;
-        use realstd::result::ResultUnwrap;
 
         #[bench]
         fn to_str_bin(b: &mut Bencher) {
@@ -857,7 +856,6 @@ mod bench {
         use super::test::Bencher;
         use rand::{XorShiftRng, Rng};
         use num::ToStrRadix;
-        use realstd::result::ResultUnwrap;
 
         #[bench]
         fn to_str_bin(b: &mut Bencher) {
@@ -894,7 +892,6 @@ mod bench {
         use super::test::Bencher;
         use rand::{XorShiftRng, Rng};
         use f64;
-        use realstd::result::ResultUnwrap;
 
         #[bench]
         fn float_to_str(b: &mut Bencher) {
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 88081d90b40..a4705b78caa 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -1073,19 +1073,19 @@ impl fmt::Show for MapError {
             ErrAlreadyExists => "File mapping for specified file already exists",
             ErrZeroLength => "Zero-length mapping not allowed",
             ErrUnknown(code) => {
-                return write!(out.buf, "Unknown error = {}", code)
+                return write!(out, "Unknown error = {}", code)
             },
             ErrVirtualAlloc(code) => {
-                return write!(out.buf, "VirtualAlloc failure = {}", code)
+                return write!(out, "VirtualAlloc failure = {}", code)
             },
             ErrCreateFileMappingW(code) => {
-                return write!(out.buf, "CreateFileMappingW failure = {}", code)
+                return write!(out, "CreateFileMappingW failure = {}", code)
             },
             ErrMapViewOfFile(code) => {
-                return write!(out.buf, "MapViewOfFile failure = {}", code)
+                return write!(out, "MapViewOfFile failure = {}", code)
             }
         };
-        write!(out.buf, "{}", str)
+        write!(out, "{}", str)
     }
 }
 
diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs
index 6029f504d10..35f32d08728 100644
--- a/src/libstd/repr.rs
+++ b/src/libstd/repr.rs
@@ -25,7 +25,7 @@ use option::{Some, None, Option};
 use ptr::RawPtr;
 use reflect;
 use reflect::{MovePtr, align};
-use result::{Ok, Err, ResultUnwrap};
+use result::{Ok, Err};
 use str::StrSlice;
 use to_str::ToStr;
 use slice::Vector;
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index c53346f69ee..1cc513825a7 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -390,9 +390,9 @@ fn begin_unwind_inner(msg: Box<Any:Send>,
                 Some(mut stderr) => {
                     Local::put(task);
                     // FIXME: what to do when the task printing fails?
-                    let _err = format_args!(|args| ::fmt::writeln(stderr, args),
-                                            "task '{}' failed at '{}', {}:{}",
-                                            n, msg_s, file, line);
+                    let _err = write!(stderr,
+                                      "task '{}' failed at '{}', {}:{}\n",
+                                      n, msg_s, file, line);
                     if backtrace::log_enabled() {
                         let _err = backtrace::write(stderr);
                     }
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs
index e8b1acb1024..5f9ea14a647 100644
--- a/src/libstd/rt/util.rs
+++ b/src/libstd/rt/util.rs
@@ -110,8 +110,9 @@ impl io::Writer for Stdio {
 }
 
 pub fn dumb_println(args: &fmt::Arguments) {
+    use io::Writer;
     let mut w = Stderr;
-    let _ = fmt::writeln(&mut w as &mut io::Writer, args);
+    let _ = writeln!(&mut w, "{}", args);
 }
 
 pub fn abort(msg: &str) -> ! {
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index 17251d31351..bc53d2bec8d 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -155,7 +155,7 @@ impl Architecture {
 
 impl fmt::Show for Abi {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "\"{}\"", self.name())
+        write!(f, "\"{}\"", self.name())
     }
 }
 
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index e5ef31a95a3..edcb8c32ecc 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -711,7 +711,7 @@ pub enum IntTy {
 
 impl fmt::Show for IntTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}",
+        write!(f, "{}",
                ast_util::int_ty_to_str(*self, None, ast_util::AutoSuffix))
     }
 }
@@ -727,7 +727,7 @@ pub enum UintTy {
 
 impl fmt::Show for UintTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}",
+        write!(f, "{}",
                ast_util::uint_ty_to_str(*self, None, ast_util::AutoSuffix))
     }
 }
@@ -741,7 +741,7 @@ pub enum FloatTy {
 
 impl fmt::Show for FloatTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", ast_util::float_ty_to_str(*self))
+        write!(f, "{}", ast_util::float_ty_to_str(*self))
     }
 }
 
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 6a7b913dce4..f1561ea31f9 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -41,7 +41,7 @@ impl PathElem {
 impl fmt::Show for PathElem {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let slot = token::get_name(self.name());
-        write!(f.buf, "{}", slot)
+        write!(f, "{}", slot)
     }
 }
 
diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs
index 84ef7941b2e..b7700cf396d 100644
--- a/src/libsyntax/crateid.rs
+++ b/src/libsyntax/crateid.rs
@@ -33,16 +33,16 @@ pub struct CrateId {
 
 impl fmt::Show for CrateId {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, "{}", self.path));
+        try!(write!(f, "{}", self.path));
         let version = match self.version {
             None => "0.0",
             Some(ref version) => version.as_slice(),
         };
         if self.path == self.name ||
                 self.path.as_slice().ends_with(format!("/{}", self.name)) {
-            write!(f.buf, "\\#{}", version)
+            write!(f, "\\#{}", version)
         } else {
-            write!(f.buf, "\\#{}:{}", self.name, version)
+            write!(f, "\\#{}:{}", self.name, version)
         }
     }
 }
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 68ce8cb2bc1..5dfd18392a9 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -594,7 +594,7 @@ impl BytesContainer for InternedString {
 
 impl fmt::Show for InternedString {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.string.as_slice())
+        write!(f, "{}", self.string.as_slice())
     }
 }
 
diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs
index a2e75e0bf9b..5fc567f06d3 100644
--- a/src/liburl/lib.rs
+++ b/src/liburl/lib.rs
@@ -427,8 +427,8 @@ fn split_char_first(s: &str, c: char) -> (StrBuf, StrBuf) {
 impl fmt::Show for UserInfo {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self.pass {
-            Some(ref pass) => write!(f.buf, "{}:{}@", self.user, *pass),
-            None => write!(f.buf, "{}@", self.user),
+            Some(ref pass) => write!(f, "{}:{}@", self.user, *pass),
+            None => write!(f, "{}@", self.user),
         }
     }
 }
@@ -824,30 +824,30 @@ impl fmt::Show for Url {
      * result in just "http://somehost.com".
      */
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, "{}:", self.scheme));
+        try!(write!(f, "{}:", self.scheme));
 
         if !self.host.is_empty() {
-            try!(write!(f.buf, "//"));
+            try!(write!(f, "//"));
             match self.user {
-                Some(ref user) => try!(write!(f.buf, "{}", *user)),
+                Some(ref user) => try!(write!(f, "{}", *user)),
                 None => {}
             }
             match self.port {
-                Some(ref port) => try!(write!(f.buf, "{}:{}", self.host,
+                Some(ref port) => try!(write!(f, "{}:{}", self.host,
                                                 *port)),
-                None => try!(write!(f.buf, "{}", self.host)),
+                None => try!(write!(f, "{}", self.host)),
             }
         }
 
-        try!(write!(f.buf, "{}", self.path));
+        try!(write!(f, "{}", self.path));
 
         if !self.query.is_empty() {
-            try!(write!(f.buf, "?{}", query_to_str(&self.query)));
+            try!(write!(f, "?{}", query_to_str(&self.query)));
         }
 
         match self.fragment {
             Some(ref fragment) => {
-                write!(f.buf, "\\#{}", encode_component(fragment.as_slice()))
+                write!(f, "\\#{}", encode_component(fragment.as_slice()))
             }
             None => Ok(()),
         }
@@ -856,14 +856,14 @@ impl fmt::Show for Url {
 
 impl fmt::Show for Path {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f.buf, "{}", self.path));
+        try!(write!(f, "{}", self.path));
         if !self.query.is_empty() {
-            try!(write!(f.buf, "?{}", self.query))
+            try!(write!(f, "?{}", self.query))
         }
 
         match self.fragment {
             Some(ref fragment) => {
-                write!(f.buf, "\\#{}", encode_component(fragment.as_slice()))
+                write!(f, "\\#{}", encode_component(fragment.as_slice()))
             }
             None => Ok(())
         }
diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs
index d75f967a229..94f1239cc08 100644
--- a/src/libuuid/lib.rs
+++ b/src/libuuid/lib.rs
@@ -154,17 +154,17 @@ impl fmt::Show for ParseError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             ErrorInvalidLength(found) =>
-                write!(f.buf, "Invalid length; expecting 32, 36 or 45 chars, \
-                               found {}", found),
+                write!(f, "Invalid length; expecting 32, 36 or 45 chars, \
+                           found {}", found),
             ErrorInvalidCharacter(found, pos) =>
-                write!(f.buf, "Invalid character; found `{}` (0x{:02x}) at \
-                               offset {}", found, found as uint, pos),
+                write!(f, "Invalid character; found `{}` (0x{:02x}) at \
+                           offset {}", found, found as uint, pos),
             ErrorInvalidGroups(found) =>
-                write!(f.buf, "Malformed; wrong number of groups: expected 1 \
-                               or 5, found {}", found),
+                write!(f, "Malformed; wrong number of groups: expected 1 \
+                           or 5, found {}", found),
             ErrorInvalidGroupLength(group, found, expecting) =>
-                write!(f.buf, "Malformed; length of group {} was {}, \
-                               expecting {}", group, found, expecting),
+                write!(f, "Malformed; length of group {} was {}, \
+                           expecting {}", group, found, expecting),
         }
     }
 }
@@ -474,7 +474,7 @@ impl FromStr for Uuid {
 /// Convert the UUID to a hexadecimal-based string representation
 impl fmt::Show for Uuid {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.to_simple_str())
+        write!(f, "{}", self.to_simple_str())
     }
 }
 
diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs
index 0abacf9ecdd..c4c2f407423 100644
--- a/src/test/auxiliary/cci_class_cast.rs
+++ b/src/test/auxiliary/cci_class_cast.rs
@@ -19,7 +19,7 @@ pub mod kitty {
 
     impl fmt::Show for cat {
         fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-            write!(f.buf, "{}", self.name)
+            write!(f, "{}", self.name)
         }
     }
 
diff --git a/src/test/compile-fail/ifmt-unimpl.rs b/src/test/compile-fail/ifmt-unimpl.rs
index 830b041bbc7..897717971bc 100644
--- a/src/test/compile-fail/ifmt-unimpl.rs
+++ b/src/test/compile-fail/ifmt-unimpl.rs
@@ -10,5 +10,5 @@
 
 fn main() {
     format!("{:d}", "3");
-    //~^ ERROR: failed to find an implementation of trait std::fmt::Signed
+    //~^ ERROR: failed to find an implementation of trait core::fmt::Signed
 }
diff --git a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs
index e95ab71e5aa..753c91d1dc9 100644
--- a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs
+++ b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs
@@ -18,7 +18,7 @@ struct Number {
 
 impl fmt::Show for Number {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.n)
+        write!(f, "{}", self.n)
     }
 }
 
diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs
index e0e60289f9d..bb101140ec3 100644
--- a/src/test/run-pass/capturing-logging.rs
+++ b/src/test/run-pass/capturing-logging.rs
@@ -26,7 +26,7 @@ struct MyWriter(ChanWriter);
 impl Logger for MyWriter {
     fn log(&mut self, record: &LogRecord) {
         let MyWriter(ref mut inner) = *self;
-        fmt::writeln(inner as &mut Writer, record.args);
+        write!(inner, "{}", record.args);
     }
 }
 
@@ -45,5 +45,7 @@ fn main() {
         debug!("debug");
         info!("info");
     });
-    assert_eq!(r.read_to_str().unwrap(), "info\n".to_owned());
+    let s = r.read_to_str().unwrap();
+    assert!(s.contains("info"));
+    assert!(!s.contains("debug"));
 }
diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs
index 874cf1233b8..fdd44740d05 100644
--- a/src/test/run-pass/class-separate-impl.rs
+++ b/src/test/run-pass/class-separate-impl.rs
@@ -53,7 +53,7 @@ fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat {
 
 impl fmt::Show for cat {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.name)
+        write!(f, "{}", self.name)
     }
 }
 
diff --git a/src/test/run-pass/colorful-write-macros.rs b/src/test/run-pass/colorful-write-macros.rs
index 802417da2c2..e9b32515187 100644
--- a/src/test/run-pass/colorful-write-macros.rs
+++ b/src/test/run-pass/colorful-write-macros.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![allow(unused_must_use, dead_code)]
+#![feature(macro_rules)]
 
 use std::io::MemWriter;
 
diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs
index 59ab75ddaaf..41650b68051 100644
--- a/src/test/run-pass/deriving-show-2.rs
+++ b/src/test/run-pass/deriving-show-2.rs
@@ -36,7 +36,7 @@ struct J(Custom);
 struct Custom;
 impl fmt::Show for Custom {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "yay")
+        write!(f, "yay")
     }
 }
 
diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs
index 56d265233ba..ee142aa8e6d 100644
--- a/src/test/run-pass/ifmt.rs
+++ b/src/test/run-pass/ifmt.rs
@@ -25,12 +25,12 @@ struct B;
 
 impl fmt::Signed for A {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.buf.write("aloha".as_bytes())
+        f.write("aloha".as_bytes())
     }
 }
 impl fmt::Signed for B {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.buf.write("adios".as_bytes())
+        f.write("adios".as_bytes())
     }
 }
 
@@ -195,9 +195,9 @@ fn test_format_args() {
     let mut buf = MemWriter::new();
     {
         let w = &mut buf as &mut io::Writer;
-        format_args!(|args| { fmt::write(w, args); }, "{}", 1);
-        format_args!(|args| { fmt::write(w, args); }, "test");
-        format_args!(|args| { fmt::write(w, args); }, "{test}", test=3);
+        format_args!(|args| { write!(w, "{}", args); }, "{}", 1);
+        format_args!(|args| { write!(w, "{}", args); }, "test");
+        format_args!(|args| { write!(w, "{}", args); }, "{test}", test=3);
     }
     let s = str::from_utf8(buf.unwrap().as_slice()).unwrap().to_owned();
     t!(s, "1test3");
diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs
index 4626c0f0c78..2ce3cb931e5 100644
--- a/src/test/run-pass/issue-2904.rs
+++ b/src/test/run-pass/issue-2904.rs
@@ -29,7 +29,7 @@ enum square {
 
 impl fmt::Show for square {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", match *self {
+        write!(f, "{}", match *self {
           bot => { "R".to_owned() }
           wall => { "#".to_owned() }
           rock => { "*".to_owned() }
diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs
index ac2ce615fee..cdc07c02677 100644
--- a/src/test/run-pass/issue-3563-3.rs
+++ b/src/test/run-pass/issue-3563-3.rs
@@ -106,7 +106,7 @@ impl fmt::Show for AsciiArt {
                               .collect::<Vec<StrBuf>>();
 
         // Concatenate the lines together using a new-line.
-        write!(f.buf, "{}", lines.connect("\n"))
+        write!(f, "{}", lines.connect("\n"))
     }
 }
 
diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs
index 30200d4cb18..7431340e413 100644
--- a/src/test/run-pass/new-impl-syntax.rs
+++ b/src/test/run-pass/new-impl-syntax.rs
@@ -17,7 +17,7 @@ struct Thingy {
 
 impl fmt::Show for Thingy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "\\{ x: {}, y: {} \\}", self.x, self.y)
+        write!(f, "\\{ x: {}, y: {} \\}", self.x, self.y)
     }
 }
 
@@ -27,7 +27,7 @@ struct PolymorphicThingy<T> {
 
 impl<T:fmt::Show> fmt::Show for PolymorphicThingy<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f.buf, "{}", self.x)
+        write!(f, "{}", self.x)
     }
 }