diff --git a/Cargo.toml b/Cargo.toml index 7eb11688..4355a3f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ members = [ ] [workspace.package] -version = "0.5.1" +version = "0.5.2" authors = ["Fangdun Tsai "] edition = "2021" homepage = "https://viz.rs" @@ -45,10 +45,10 @@ license = "MIT" rust-version = "1.63" # follows `tokio` and `hyper` [workspace.dependencies] -viz = { version = "0.5.1", path = "viz" } -viz-core = { version = "0.5.1", path = "viz-core" } -viz-router = { version = "0.5.1", path = "viz-router" } -viz-handlers = { version = "0.5.1", path = "viz-handlers", default-features = false } +viz = { version = "0.5.2", path = "viz" } +viz-core = { version = "0.5.2", path = "viz-core" } +viz-router = { version = "0.5.2", path = "viz-router" } +viz-handlers = { version = "0.5.2", path = "viz-handlers", default-features = false } viz-macros = { version = "0.1", path = "viz-macros" } viz-test = { version = "0.1", path = "viz-test" } diff --git a/viz-core/src/from_request.rs b/viz-core/src/from_request.rs index ce3043de..9d6d29e1 100644 --- a/viz-core/src/from_request.rs +++ b/viz-core/src/from_request.rs @@ -11,7 +11,6 @@ pub trait FromRequest: Sized { type Error: IntoResponse; /// Extracts this type from the HTTP [`Request`]. - #[must_use] async fn extract(req: &mut Request) -> Result; } diff --git a/viz-core/src/handler.rs b/viz-core/src/handler.rs index 74ff2988..b022642e 100644 --- a/viz-core/src/handler.rs +++ b/viz-core/src/handler.rs @@ -45,7 +45,6 @@ pub trait Handler: dyn_clone::DynClone + Send + Sync + 'static { type Output; /// Performs the call operation. - #[must_use] async fn call(&self, input: Input) -> Self::Output; } @@ -67,7 +66,7 @@ where /// The [`HandlerExt`] trait, which provides adapters for chaining and composing handlers. /// -/// Likes the [`FutureExt`] and [`StreamExt`] trait. +/// Likes the [`FutureExt`] and [`StreamExt`] traits. /// /// [`FutureExt`]: https://docs.rs/futures/latest/futures/future/trait.FutureExt.html /// [`StreamExt`]: https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html diff --git a/viz-core/src/request.rs b/viz-core/src/request.rs index 44d1fd87..a394caa8 100644 --- a/viz-core/src/request.rs +++ b/viz-core/src/request.rs @@ -1,5 +1,3 @@ -use std::mem::replace; - use crate::{ async_trait, header, types::{PayloadError, RealIp}, @@ -37,7 +35,7 @@ use crate::types::Session; #[cfg(feature = "params")] use crate::types::{ParamsError, PathDeserializer, RouteInfo}; -/// The [Request] Extension. +/// The [`Request`] Extension. #[async_trait] pub trait RequestExt: Sized { /// Get URL's schema of this request. @@ -255,7 +253,7 @@ impl RequestExt for Request { } fn incoming_body(&mut self) -> IncomingBody { - replace(self.body_mut(), IncomingBody::used()) + std::mem::replace(self.body_mut(), IncomingBody::used()) } fn incoming(&mut self) -> Result { @@ -267,12 +265,11 @@ impl RequestExt for Request { } async fn bytes(&mut self) -> Result { - // self.body_mut() self.incoming()? .collect() .await - .map_err(|_| PayloadError::Read) .map(Collected::to_bytes) + .map_err(|_| PayloadError::Read) } #[cfg(feature = "limits")]