From 79aeec8df63322b643c3367fb066ab640ff8c1df Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Sat, 29 Jun 2024 21:51:15 +0300 Subject: [PATCH] chore: apply clippy suggestions (#208) * perf: apply clippy suggestions * allow some unused imports, remove unused import --- crates/lib/src/games/battalion1944.rs | 4 ++-- crates/lib/src/games/definitions.rs | 3 --- crates/lib/src/games/minecraft/mod.rs | 1 + crates/lib/src/lib.rs | 1 + crates/lib/src/protocols/epic/protocol.rs | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/lib/src/games/battalion1944.rs b/crates/lib/src/games/battalion1944.rs index b6d4851..fc4e9b6 100644 --- a/crates/lib/src/games/battalion1944.rs +++ b/crates/lib/src/games/battalion1944.rs @@ -31,12 +31,12 @@ pub fn query(address: &IpAddr, port: Option) -> GDResult { } if let Some(bat_name) = rules.get("bat_name_s") { - valve_response.info.name = bat_name.clone(); + valve_response.info.name.clone_from(bat_name); rules.remove("bat_name_s"); } if let Some(bat_gamemode) = rules.get("bat_gamemode_s") { - valve_response.info.game_mode = bat_gamemode.clone(); + valve_response.info.game_mode.clone_from(bat_gamemode); rules.remove("bat_gamemode_s"); } diff --git a/crates/lib/src/games/definitions.rs b/crates/lib/src/games/definitions.rs index 7897ef9..55f1453 100644 --- a/crates/lib/src/games/definitions.rs +++ b/crates/lib/src/games/definitions.rs @@ -8,9 +8,6 @@ use crate::protocols::types::{GatherToggle, ProprietaryProtocol}; use crate::protocols::valve::GatheringSettings; use phf::{phf_map, Map}; -#[cfg(feature = "tls")] -use crate::protocols::epic::Credentials; - macro_rules! game { ($name: literal, $default_port: expr, $protocol: expr) => { game!( diff --git a/crates/lib/src/games/minecraft/mod.rs b/crates/lib/src/games/minecraft/mod.rs index aa8b28e..dbb8c34 100644 --- a/crates/lib/src/games/minecraft/mod.rs +++ b/crates/lib/src/games/minecraft/mod.rs @@ -4,6 +4,7 @@ pub mod protocol; /// All types used by the implementation. pub mod types; +#[allow(unused_imports)] pub use protocol::*; pub use types::*; diff --git a/crates/lib/src/lib.rs b/crates/lib/src/lib.rs index ea27255..be23fec 100644 --- a/crates/lib/src/lib.rs +++ b/crates/lib/src/lib.rs @@ -55,6 +55,7 @@ pub mod capture; pub use errors::*; #[cfg(feature = "games")] pub use games::*; +#[allow(unused_imports)] #[cfg(feature = "games")] pub use query::*; #[cfg(feature = "services")] diff --git a/crates/lib/src/protocols/epic/protocol.rs b/crates/lib/src/protocols/epic/protocol.rs index 7314f36..6d57e70 100644 --- a/crates/lib/src/protocols/epic/protocol.rs +++ b/crates/lib/src/protocols/epic/protocol.rs @@ -10,7 +10,7 @@ use serde::Serialize; use serde_json::Value; use std::net::SocketAddr; -const EPIC_API_ENDPOINT: &'static str = "https://api.epicgames.dev"; +const EPIC_API_ENDPOINT: &str = "https://api.epicgames.dev"; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[derive(Debug, Clone, PartialEq, Eq)] @@ -69,7 +69,7 @@ impl EpicProtocol { pub fn auth_by_client(&mut self) -> GDResult { let body = [ ("grant_type", "client_credentials"), - ("deployment_id", &self.credentials.deployment), + ("deployment_id", self.credentials.deployment), ]; let auth_format = format!("{}:{}", self.credentials.id, self.credentials.secret);