From 402cd3034da33442e6b0c2d41cf333127043850a Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Wed, 6 Dec 2017 17:32:58 +0100 Subject: [PATCH] Avoid allocation when return a `WouldBlock` io::Error (#65) --- src/net/tcp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/tcp.rs b/src/net/tcp.rs index 445556c88..302c731c0 100644 --- a/src/net/tcp.rs +++ b/src/net/tcp.rs @@ -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() {