From cb0265ab231221b0c908f7f1cef2f74eb30c45af Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Tue, 10 Aug 2021 10:38:00 -0700 Subject: [PATCH] fix: address new clippy lints --- src/listener/tcp_listener.rs | 6 +++--- src/listener/unix_listener.rs | 6 +++--- src/route.rs | 2 +- src/security/cors.rs | 4 ++-- src/server.rs | 2 +- src/sessions/middleware.rs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/listener/tcp_listener.rs b/src/listener/tcp_listener.rs index 9ca3585f8..7b86a013a 100644 --- a/src/listener/tcp_listener.rs +++ b/src/listener/tcp_listener.rs @@ -129,10 +129,10 @@ where impl fmt::Debug for TcpListener { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("TcpListener") - .field(&"listener", &self.listener) - .field(&"addrs", &self.addrs) + .field("listener", &self.listener) + .field("addrs", &self.addrs) .field( - &"server", + "server", if self.server.is_some() { &"Some(Server)" } else { diff --git a/src/listener/unix_listener.rs b/src/listener/unix_listener.rs index ca731926d..d99a21d30 100644 --- a/src/listener/unix_listener.rs +++ b/src/listener/unix_listener.rs @@ -127,10 +127,10 @@ where impl fmt::Debug for UnixListener { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("UnixListener") - .field(&"listener", &self.listener) - .field(&"path", &self.path) + .field("listener", &self.listener) + .field("path", &self.path) .field( - &"server", + "server", if self.server.is_some() { &"Some(Server)" } else { diff --git a/src/route.rs b/src/route.rs index 24a01818b..66fda966c 100644 --- a/src/route.rs +++ b/src/route.rs @@ -284,7 +284,7 @@ where } = req; let rest = crate::request::rest(&route_params).unwrap_or(""); - req.url_mut().set_path(&rest); + req.url_mut().set_path(rest); self.0 .call(crate::Request { diff --git a/src/security/cors.rs b/src/security/cors.rs index 004a8d787..d59cdf4c0 100644 --- a/src/security/cors.rs +++ b/src/security/cors.rs @@ -146,7 +146,7 @@ impl Middleware for CorsMiddleware let origins = origins.unwrap(); let origin = origins.last(); - if !self.is_valid_origin(&origin) { + if !self.is_valid_origin(origin) { return Ok(http_types::Response::new(StatusCode::Unauthorized).into()); } @@ -159,7 +159,7 @@ impl Middleware for CorsMiddleware response.insert_header( headers::ACCESS_CONTROL_ALLOW_ORIGIN, - self.response_origin(&origin), + self.response_origin(origin), ); if let Some(allow_credentials) = &self.allow_credentials { diff --git a/src/server.rs b/src/server.rs index 77ef1f278..1e6f8c1ab 100644 --- a/src/server.rs +++ b/src/server.rs @@ -289,7 +289,7 @@ where } = self.clone(); let method = req.method().to_owned(); - let Selection { endpoint, params } = router.route(&req.url().path(), method); + let Selection { endpoint, params } = router.route(req.url().path(), method); let route_params = vec![params]; let req = Request::new(state, req, route_params); diff --git a/src/sessions/middleware.rs b/src/sessions/middleware.rs index ec91af3c6..ce564f725 100644 --- a/src/sessions/middleware.rs +++ b/src/sessions/middleware.rs @@ -271,7 +271,7 @@ impl SessionMiddleware { /// Signs the cookie's value providing integrity and authenticity. fn sign_cookie(&self, cookie: &mut Cookie<'_>) { // Compute HMAC-SHA256 of the cookie's value. - let mut mac = Hmac::::new_from_slice(&self.key.signing()).expect("good key"); + let mut mac = Hmac::::new_from_slice(self.key.signing()).expect("good key"); mac.update(cookie.value().as_bytes()); // Cookie's new value is [MAC | original-value]. @@ -295,7 +295,7 @@ impl SessionMiddleware { let digest = base64::decode(digest_str).map_err(|_| "bad base64 digest")?; // Perform the verification. - let mut mac = Hmac::::new_from_slice(&self.key.signing()).expect("good key"); + let mut mac = Hmac::::new_from_slice(self.key.signing()).expect("good key"); mac.update(value.as_bytes()); mac.verify(&digest) .map(|_| value.to_string())