Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,15 +792,19 @@ pub fn write(output: &mut Write, args: Arguments) -> Result {
None => {
// We can use default formatting parameters for all arguments.
for (arg, piece) in args.args.iter().zip(pieces.by_ref()) {
try!(formatter.buf.write_str(*piece));
if !piece.is_empty() {
try!(formatter.buf.write_str(*piece));
}
try!((arg.formatter)(arg.value, &mut formatter));
}
}
Some(fmt) => {
// Every spec has a corresponding argument that is preceded by
// a string piece.
for (arg, piece) in fmt.iter().zip(pieces.by_ref()) {
try!(formatter.buf.write_str(*piece));
if !piece.is_empty() {
try!(formatter.buf.write_str(*piece));
}
try!(formatter.run(arg));
}
}
Expand All @@ -809,7 +813,9 @@ pub fn write(output: &mut Write, args: Arguments) -> Result {
// There can be only one trailing string piece left.
match pieces.next() {
Some(piece) => {
try!(formatter.buf.write_str(*piece));
if !piece.is_empty() {
try!(formatter.buf.write_str(*piece));
}
}
None => {}
}
Expand Down