mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
BufWriter: simplify buffer draining
This commit is contained in:
parent
85bc88df5f
commit
0f29dc40f8
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user