Skip to content

Commit

Permalink
BufWriter: simplify buffer draining
Browse files Browse the repository at this point in the history
  • Loading branch information
tgnottingham committed Apr 13, 2021
1 parent 85bc88d commit 0f29dc4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions library/std/src/io/buffered/bufwriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ impl<W: Write> BufWriter<W> {
impl Drop for BufGuard<'_> {
fn drop(&mut self) {
if self.written > 0 {
if self.done() {
self.buffer.clear();
} else {
self.buffer.drain(..self.written);
}
self.buffer.drain(..self.written);
}
}
}
Expand Down

0 comments on commit 0f29dc4

Please sign in to comment.