remove unnecessary negation

This commit is contained in:
Edward Shen 2021-06-06 18:03:47 -04:00
parent 1839b64807
commit 75752eb13e
Signed by: edward
GPG key ID: 19182661E818369F

6
src/cache/fs.rs vendored
View file

@ -397,7 +397,9 @@ impl AsyncWrite for EncryptedDiskWriter {
mut self: Pin<&mut Self>, mut self: Pin<&mut Self>,
cx: &mut Context<'_>, cx: &mut Context<'_>,
) -> Poll<Result<(), std::io::Error>> { ) -> Poll<Result<(), std::io::Error>> {
if !self.as_ref().write_buffer.is_empty() { if self.as_ref().write_buffer.is_empty() {
self.file.as_mut().poll_flush(cx)
} else {
let new_self = Pin::into_inner(self); let new_self = Pin::into_inner(self);
let buffer = new_self.write_buffer.as_ref(); let buffer = new_self.write_buffer.as_ref();
match new_self.file.as_mut().poll_write(cx, buffer) { match new_self.file.as_mut().poll_write(cx, buffer) {
@ -412,8 +414,6 @@ impl AsyncWrite for EncryptedDiskWriter {
} }
Poll::Pending => Poll::Pending, Poll::Pending => Poll::Pending,
} }
} else {
self.file.as_mut().poll_flush(cx)
} }
} }