Skip to content

Commit

Permalink
fix: address new clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishrock123 committed Aug 10, 2021
1 parent 73ee013 commit cb0265a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/listener/tcp_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ where
impl<State> fmt::Debug for TcpListener<State> {
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<State>)"
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/listener/unix_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ where
impl<State> fmt::Debug for UnixListener<State> {
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<State>)"
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/security/cors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<State: Clone + Send + Sync + 'static> Middleware<State> 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());
}

Expand All @@ -159,7 +159,7 @@ impl<State: Clone + Send + Sync + 'static> Middleware<State> 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 {
Expand Down
2 changes: 1 addition & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/sessions/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl<Store: SessionStore> SessionMiddleware<Store> {
/// 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::<Sha256>::new_from_slice(&self.key.signing()).expect("good key");
let mut mac = Hmac::<Sha256>::new_from_slice(self.key.signing()).expect("good key");
mac.update(cookie.value().as_bytes());

// Cookie's new value is [MAC | original-value].
Expand All @@ -295,7 +295,7 @@ impl<Store: SessionStore> SessionMiddleware<Store> {
let digest = base64::decode(digest_str).map_err(|_| "bad base64 digest")?;

// Perform the verification.
let mut mac = Hmac::<Sha256>::new_from_slice(&self.key.signing()).expect("good key");
let mut mac = Hmac::<Sha256>::new_from_slice(self.key.signing()).expect("good key");
mac.update(value.as_bytes());
mac.verify(&digest)
.map(|_| value.to_string())
Expand Down

0 comments on commit cb0265a

Please sign in to comment.