fix test fallout

This commit is contained in:
Alex Burka 2018-11-03 05:03:30 +00:00
parent d5e3e8a89f
commit 706a1cc0f2
2 changed files with 7 additions and 7 deletions

View file

@ -310,10 +310,10 @@ trait IteratorExt: Iterator + Sized {
where Self::Item: std::fmt::Display {
let mut s = String::new();
if let Some(e) = self.next() {
write!(s, "{}", e);
write!(s, "{}", e).unwrap();
for e in self {
s.push_str(sep);
write!(s, "{}", e);
write!(s, "{}", e).unwrap();
}
}
s
@ -537,7 +537,7 @@ fn format_weeks(it: impl Iterator<Item = impl DateIterator>) -> impl Iterator<It
first = false;
}
write!(buf, " {:>2}", d.day());
write!(buf, " {:>2}", d.day()).unwrap();
}
// Insert more filler at the end to fill up the remainder of the week,

View file

@ -27,18 +27,18 @@ impl fmt::Write for Bar {
}
fn borrowing_writer_from_struct_and_formatting_struct_field(foo: Foo) {
write!(foo.writer, "{}", foo.other);
write!(foo.writer, "{}", foo.other).unwrap();
}
fn main() {
let mut w = Vec::new();
write!(&mut w as &mut Write, "");
write!(&mut w, ""); // should coerce
write!(&mut w as &mut Write, "").unwrap();
write!(&mut w, "").unwrap(); // should coerce
println!("ok");
let mut s = Bar;
{
use std::fmt::Write;
write!(&mut s, "test");
write!(&mut s, "test").unwrap();
}
}