From efa1ffcad085f82fd0c390733f7910009a8c033d Mon Sep 17 00:00:00 2001 From: Fangdun Tsai Date: Mon, 1 Jan 2024 13:47:09 +0800 Subject: [PATCH] chore(core): remove redundance bounds on docs --- viz/src/lib.rs | 11 +++++------ viz/src/responder.rs | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/viz/src/lib.rs b/viz/src/lib.rs index 2d8e2178..6332174c 100644 --- a/viz/src/lib.rs +++ b/viz/src/lib.rs @@ -84,10 +84,9 @@ //! type Output = Result; //! //! async fn call(&self, req: Request) -> Self::Output { -//! let code = self.code.clone(); //! let path = req.path(); //! let method = req.method().clone(); -//! let code = code.fetch_add(1, Ordering::SeqCst); +//! let code = self.code.fetch_add(1, Ordering::SeqCst); //! Ok(format!("code = {}, method = {}, path = {}", code, method, path).into_response()) //! } //! } @@ -190,7 +189,7 @@ //! //! async fn around((req, handler): Next) -> Result //! where -//! H: Handler> + Clone, +//! H: Handler>, //! { //! // before ... //! let result = handler.call(req).await; @@ -240,7 +239,7 @@ //! // middleware fn //! async fn around((req, handler): Next) -> Result //! where -//! H: Handler> + Clone, +//! H: Handler>, //! { //! // before ... //! let result = handler.call(req).await; @@ -255,7 +254,7 @@ //! #[async_trait] //! impl Handler> for MyMiddleware //! where -//! H: Handler + Clone, +//! H: Handler, //! { //! type Output = H::Output; //! @@ -290,7 +289,7 @@ //! #[async_trait] //! impl Handler for TimeoutMiddleware //! where -//! H: Handler + Clone, +//! H: Handler, //! { //! type Output = H::Output; //! diff --git a/viz/src/responder.rs b/viz/src/responder.rs index 92a74c28..624933cc 100644 --- a/viz/src/responder.rs +++ b/viz/src/responder.rs @@ -52,12 +52,11 @@ where params: route.params().into(), })); - let req = req.map(Body::Incoming); let handler = handler.clone(); Box::pin(async move { Ok(handler - .call(req) + .call(req.map(Body::Incoming)) .await .unwrap_or_else(IntoResponse::into_response)) })