perf(http): prefer ErrorKind::WouldBlock
Improved codegen, without allocations or function calls
This commit is contained in:
@@ -202,7 +202,7 @@ impl Chunked {
|
||||
match *self {
|
||||
Chunked::Init |
|
||||
Chunked::End => Ok(msg.len()),
|
||||
_ => Err(io::Error::new(io::ErrorKind::WouldBlock, "chunked incomplete"))
|
||||
_ => Err(io::ErrorKind::WouldBlock.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user