From 34ab565683e31d1d8bb1c9a7e07964ec4b070e55 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 19 Feb 2025 22:24:56 +0000 Subject: [PATCH] chore: address clippy warnings --- graphql/async-graphql/src/star_wars/model.rs | 4 ++-- guards/src/main.rs | 4 ++-- middleware/http-to-https/src/main.rs | 4 ++-- websockets/chat-tcp/src/server.rs | 2 +- websockets/chat/src/server.rs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/graphql/async-graphql/src/star_wars/model.rs b/graphql/async-graphql/src/star_wars/model.rs index c15be5a8..ad0ce124 100644 --- a/graphql/async-graphql/src/star_wars/model.rs +++ b/graphql/async-graphql/src/star_wars/model.rs @@ -22,7 +22,7 @@ pub struct Human<'a>(&'a StarWarsChar); /// A humanoid creature in the Star Wars universe. #[Object] -impl<'a> Human<'a> { +impl Human<'_> { /// The id of the human. async fn id(&self) -> &str { self.0.id @@ -63,7 +63,7 @@ pub struct Droid<'a>(&'a StarWarsChar); /// A mechanical creature in the Star Wars universe. #[Object] -impl<'a> Droid<'a> { +impl Droid<'_> { /// The id of the droid. async fn id(&self) -> &str { self.0.id diff --git a/guards/src/main.rs b/guards/src/main.rs index bbc40605..c91ec959 100644 --- a/guards/src/main.rs +++ b/guards/src/main.rs @@ -17,7 +17,7 @@ mod v1 { ctx.head() .headers() .get("Accept-Version") - .map_or(false, |hv| hv.as_bytes() == b"1") + .is_some_and(|hv| hv.as_bytes() == b"1") } } @@ -37,7 +37,7 @@ mod v2 { ctx.head() .headers() .get("Accept-Version") - .map_or(false, |hv| hv.as_bytes() == b"2") + .is_some_and(|hv| hv.as_bytes() == b"2") } } diff --git a/middleware/http-to-https/src/main.rs b/middleware/http-to-https/src/main.rs index 8355d4c7..a7f06556 100644 --- a/middleware/http-to-https/src/main.rs +++ b/middleware/http-to-https/src/main.rs @@ -52,11 +52,11 @@ async fn main() -> std::io::Result<()> { Either::Left(srv.call(sreq).map(|res| res)) } else { println!("An http request has arrived here, i will redirect it to use https"); - return Either::Right(future::ready(Ok(sreq.into_response( + Either::Right(future::ready(Ok(sreq.into_response( HttpResponse::MovedPermanently() .append_header((http::header::LOCATION, url)) .finish(), - )))); + )))) } }) .service(index) diff --git a/websockets/chat-tcp/src/server.rs b/websockets/chat-tcp/src/server.rs index 6a288012..c62eac99 100644 --- a/websockets/chat-tcp/src/server.rs +++ b/websockets/chat-tcp/src/server.rs @@ -10,7 +10,7 @@ use rand::{rngs::ThreadRng, Rng}; use crate::session; /// Message for chat server communications - +/// /// New chat session is created #[derive(Message)] #[rtype(usize)] diff --git a/websockets/chat/src/server.rs b/websockets/chat/src/server.rs index fe0f7958..f2c8836a 100644 --- a/websockets/chat/src/server.rs +++ b/websockets/chat/src/server.rs @@ -19,7 +19,7 @@ use rand::{rngs::ThreadRng, Rng}; pub struct Message(pub String); /// Message for chat server communications - +/// /// New chat session is created #[derive(Message)] #[rtype(usize)]