From 3e621db606ffa8046f37be838223cf85815a119f Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 5 Jun 2024 04:56:46 +0100 Subject: [PATCH] chore: address clippy lints --- graphql/async-graphql/src/star_wars/model.rs | 1 + websockets/chat-tcp/src/main.rs | 2 +- websockets/chat-tcp/src/session.rs | 2 +- websockets/chat/src/session.rs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/graphql/async-graphql/src/star_wars/model.rs b/graphql/async-graphql/src/star_wars/model.rs index c125bc6..c15be5a 100644 --- a/graphql/async-graphql/src/star_wars/model.rs +++ b/graphql/async-graphql/src/star_wars/model.rs @@ -168,6 +168,7 @@ impl QueryRoot { } } +#[allow(clippy::duplicated_attributes)] // false positive #[derive(Interface)] #[graphql( field(name = "id", ty = "&str"), diff --git a/websockets/chat-tcp/src/main.rs b/websockets/chat-tcp/src/main.rs index c6d3235..f94113f 100644 --- a/websockets/chat-tcp/src/main.rs +++ b/websockets/chat-tcp/src/main.rs @@ -150,7 +150,7 @@ impl StreamHandler> for WsChatSession { } "/join" => { if v.len() == 2 { - self.room = v[1].to_owned(); + v[1].clone_into(&mut self.room); self.addr.do_send(server::Join { id: self.id, name: self.room.clone(), diff --git a/websockets/chat-tcp/src/session.rs b/websockets/chat-tcp/src/session.rs index 43f8af5..d7d5c78 100644 --- a/websockets/chat-tcp/src/session.rs +++ b/websockets/chat-tcp/src/session.rs @@ -103,7 +103,7 @@ impl StreamHandler> for ChatSession { } Ok(ChatRequest::Join(name)) => { println!("Join to room: {name}"); - self.room = name.clone(); + name.clone_into(&mut self.room); self.addr.do_send(server::Join { id: self.id, name: name.clone(), diff --git a/websockets/chat/src/session.rs b/websockets/chat/src/session.rs index 72f6a3c..03d2815 100644 --- a/websockets/chat/src/session.rs +++ b/websockets/chat/src/session.rs @@ -154,7 +154,7 @@ impl StreamHandler> for WsChatSession { } "/join" => { if v.len() == 2 { - self.room = v[1].to_owned(); + v[1].clone_into(&mut self.room); self.addr.do_send(server::Join { id: self.id, name: self.room.clone(),