Prefer ErrorKind::WouldBlock

This commit is contained in:
arthurprs
2017-09-03 18:39:04 +02:00
parent e8617ea1fc
commit f12b761b77
5 changed files with 14 additions and 20 deletions
+3 -3
View File
@@ -46,7 +46,7 @@ impl<T: Read> Read for ReadHalf<T> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
match self.handle.poll_lock() {
Async::Ready(mut l) => l.read(buf),
Async::NotReady => Err(::would_block()),
Async::NotReady => Err(io::ErrorKind::WouldBlock.into()),
}
}
}
@@ -55,14 +55,14 @@ impl<T: Write> Write for WriteHalf<T> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
match self.handle.poll_lock() {
Async::Ready(mut l) => l.write(buf),
Async::NotReady => Err(::would_block()),
Async::NotReady => Err(io::ErrorKind::WouldBlock.into()),
}
}
fn flush(&mut self) -> io::Result<()> {
match self.handle.poll_lock() {
Async::Ready(mut l) => l.flush(),
Async::NotReady => Err(::would_block()),
Async::NotReady => Err(io::ErrorKind::WouldBlock.into()),
}
}
}