Avoid allocation when return a WouldBlock io::Error (#65)

This commit is contained in:
Thomas de Zeeuw
2017-12-06 10:32:58 -06:00
committed by Alex Crichton
parent cf793d4053
commit 402cd3034d
+1 -1
View File
@@ -77,7 +77,7 @@ impl TcpListener {
/// called outside the context of a future.
pub fn accept_std(&mut self) -> io::Result<(net::TcpStream, SocketAddr)> {
if let Async::NotReady = self.io.poll_read() {
return Err(io::Error::new(io::ErrorKind::WouldBlock, "not ready"))
return Err(io::ErrorKind::WouldBlock.into())
}
match self.io.get_ref().accept_std() {