diff --git a/viz/src/responder.rs b/viz/src/responder.rs index 9f062c56..415c9bae 100644 --- a/viz/src/responder.rs +++ b/viz/src/responder.rs @@ -55,7 +55,7 @@ where .map(Result::Ok), ) } else { - Box::pin(async { Ok(StatusCode::NOT_FOUND.into_response()) }) + Box::pin(not_found()) } } } @@ -72,3 +72,8 @@ where Handler::call(self, req) } } + +#[inline(always)] +async fn not_found() -> Result { + Ok(StatusCode::NOT_FOUND.into_response()) +} diff --git a/viz/src/server.rs b/viz/src/server.rs index c93da72c..73ca7b53 100644 --- a/viz/src/server.rs +++ b/viz/src/server.rs @@ -48,7 +48,7 @@ impl Server { impl IntoFuture for Server where L: Accept + Send + 'static, - L::Conn: AsyncWrite + AsyncRead + Unpin + Send, + L::Conn: AsyncWrite + AsyncRead + Send + Unpin, L::Addr: Clone + Send + Sync + 'static, { type Output = Result<()>; @@ -60,7 +60,6 @@ where listener, builder, } = self; - Box::pin(async move { loop { let (stream, remote_addr) = listener.accept().await?;