perf(http): prefer ErrorKind::WouldBlock

Improved codegen, without allocations or function calls
This commit is contained in:
arthurprs
2017-09-03 18:58:19 +02:00
parent 50fd4ab96d
commit 1e7e1c921c
3 changed files with 4 additions and 4 deletions

View File

@@ -132,7 +132,7 @@ impl<T: Write> Write for Buffered<T> {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
let n = self.write_buf.buffer(data);
if n == 0 {
Err(io::Error::from(io::ErrorKind::WouldBlock))
Err(io::ErrorKind::WouldBlock.into())
} else {
Ok(n)
}