Skip to content

Commit 15e60eb

Browse files
committed
std: Refactor flush method in BufWriter to use the ? operator
1 parent 9ec5d5f commit 15e60eb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

library/std/src/io/buffered/bufwriter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,8 @@ impl<W: ?Sized + Write> Write for BufWriter<W> {
641641
}
642642

643643
fn flush(&mut self) -> io::Result<()> {
644-
self.flush_buf().and_then(|()| self.get_mut().flush())
644+
self.flush_buf()?;
645+
self.get_mut().flush()
645646
}
646647
}
647648

0 commit comments

Comments
 (0)