Skip to content

Commit 6f536cf

Browse files
Rollup merge of rust-lang#155741 - xtqqczze:question-mark-bufwriter-flush, r=WaffleLapkin
std: Refactor BufWriter::flush to use the `?` operator Functionally, this is equivalent and may be slightly more amenable to inlining.
2 parents 39d8424 + 15e60eb commit 6f536cf

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)