Auto merge of #24519 - rprichard:opt-write-args, r=alexcrichton

It's just as convenient, but it's much faster. Using write! requires an
extra call to fmt::write and a extra dynamically dispatched call to
Arguments' Display format function.
This commit is contained in:
bors 2015-04-18 12:35:07 +00:00
commit fcf637b19f
3 changed files with 3 additions and 3 deletions

View file

@ -443,6 +443,6 @@ use string;
#[stable(feature = "rust1", since = "1.0.0")]
pub fn format(args: Arguments) -> string::String {
let mut output = string::String::new();
let _ = write!(&mut output, "{}", args);
let _ = output.write_fmt(args);
output
}

View file

@ -504,7 +504,7 @@ pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, u32)) ->
// below).
let mut s = String::new();
let _ = write!(&mut s, "{}", msg);
let _ = s.write_fmt(msg);
begin_unwind_inner(Box::new(s), file_line)
}

View file

@ -65,7 +65,7 @@ pub const ENFORCE_SANITY: bool = true || !cfg!(rtopt) || cfg!(rtdebug) ||
cfg!(rtassert);
pub fn dumb_print(args: fmt::Arguments) {
let _ = write!(&mut Stderr::new(), "{}", args);
let _ = Stderr::new().write_fmt(args);
}
pub fn abort(args: fmt::Arguments) -> ! {