From ebfcbd2c759dc232e210b59c3a4a56f66f22f4a3 Mon Sep 17 00:00:00 2001 From: sheshnath-at-knoldus Date: Thu, 1 Aug 2024 18:39:08 +0530 Subject: [PATCH] fixed clippy warnings --- core/codegen/src/attribute/route/mod.rs | 8 ++++++-- core/lib/src/listener/tcp.rs | 2 +- core/lib/src/listener/unix.rs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/codegen/src/attribute/route/mod.rs b/core/codegen/src/attribute/route/mod.rs index 50610249..b2979d3f 100644 --- a/core/codegen/src/attribute/route/mod.rs +++ b/core/codegen/src/attribute/route/mod.rs @@ -266,8 +266,12 @@ fn internal_uri_macro_decl(route: &Route) -> TokenStream { route.attr.method.as_ref().map(|m| m.0.hash(&mut hasher)); route.attr.uri.path().hash(&mut hasher); route.attr.uri.query().hash(&mut hasher); - route.attr.data.as_ref().map(|d| d.value.hash(&mut hasher)); - route.attr.format.as_ref().map(|f| f.0.hash(&mut hasher)); + if let Some(data) = &route.attr.data { + data.value.hash(&mut hasher); + } + if let Some(format) = &route.attr.format { + format.0.hash(&mut hasher); + } }); let route_uri = route.attr.uri.to_string(); diff --git a/core/lib/src/listener/tcp.rs b/core/lib/src/listener/tcp.rs index 61252c7d..bdf337ee 100644 --- a/core/lib/src/listener/tcp.rs +++ b/core/lib/src/listener/tcp.rs @@ -24,7 +24,7 @@ impl Bind for TcpListener { type Error = Either; async fn bind(rocket: &Rocket) -> Result { - let endpoint = Self::bind_endpoint(&rocket)?; + let endpoint = Self::bind_endpoint(rocket)?; let addr = endpoint.tcp() .ok_or_else(|| io::Error::other("internal error: invalid endpoint")) .map_err(Right)?; diff --git a/core/lib/src/listener/unix.rs b/core/lib/src/listener/unix.rs index a6992a7a..37a22b9d 100644 --- a/core/lib/src/listener/unix.rs +++ b/core/lib/src/listener/unix.rs @@ -75,7 +75,7 @@ impl Bind for UnixListener { type Error = Either; async fn bind(rocket: &Rocket) -> Result { - let endpoint = Self::bind_endpoint(&rocket)?; + let endpoint = Self::bind_endpoint(rocket)?; let path = endpoint.unix() .ok_or_else(|| Right(io::Error::other("internal error: invalid endpoint")))?;