about summary refs log tree commit diff
path: root/src/libstd/fmt
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-02-28 12:55:30 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-03-01 10:06:20 -0800
commit2cb83fdd7ea4e76d4b1c830a97480521cc405625 (patch)
treedc3f78a323c4d2c875fdb98f1b2b9d49b70759ef /src/libstd/fmt
parent1ee94a1336071fb0319b23a6c73b3d83ccd66bdf (diff)
downloadrust-2cb83fdd7ea4e76d4b1c830a97480521cc405625.tar.gz
rust-2cb83fdd7ea4e76d4b1c830a97480521cc405625.zip
std: Switch stdout/stderr to buffered by default
Similarly to #12422 which made stdin buffered by default, this commit makes the
output streams also buffered by default. Now that buffered writers will flush
their contents when they are dropped, I don't believe that there's no reason why
the output shouldn't be buffered by default, which is what you want in 90% of
cases.

As with stdin, there are new stdout_raw() and stderr_raw() functions to get
unbuffered streams to stdout/stderr.
Diffstat (limited to 'src/libstd/fmt')
-rw-r--r--src/libstd/fmt/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs
index bdc1aa75c94..67e2fc00b8b 100644
--- a/src/libstd/fmt/mod.rs
+++ b/src/libstd/fmt/mod.rs
@@ -654,8 +654,8 @@ uniform_fn_call_workaround! {
 /// use std::fmt;
 /// use std::io;
 ///
-/// let w = &mut io::stdout() as &mut io::Writer;
-/// format_args!(|args| { fmt::write(w, args); }, "Hello, {}!", "world");
+/// let mut w = io::stdout();
+/// format_args!(|args| { fmt::write(&mut w, args); }, "Hello, {}!", "world");
 /// ```
 pub fn write(output: &mut io::Writer, args: &Arguments) -> Result {
     unsafe { write_unsafe(output, args.fmt, args.args) }