diff --git a/server/central/src/main.rs b/server/central/src/main.rs index 4fbe13b23..80990edb9 100644 --- a/server/central/src/main.rs +++ b/server/central/src/main.rs @@ -16,14 +16,13 @@ use std::{ time::Duration, }; -use async_watcher::{notify::RecursiveMode, AsyncDebouncer}; +use async_watcher::{AsyncDebouncer, notify::RecursiveMode}; use config::ServerConfig; use db::GlobedDb; use game_pinger::GameServerPinger; use globed_shared::{ - get_log_level, - logger::{error, info, log, warn, Logger}, - LogLevelFilter, + LogLevelFilter, get_log_level, + logger::{Logger, error, info, log, warn}, }; use rocket::catchers; use rocket_db_pools::Database; @@ -62,7 +61,7 @@ async fn main() -> Result<(), Box> { // create Rocket.toml if it doesn't exist let rocket_toml = std::env::var("ROCKET_CONFIG").map_or_else(|_| std::env::current_dir().unwrap().join("Rocket.toml"), PathBuf::from); - if !rocket_toml.file_name().is_some_and(|x| x == "Rocket.toml") || !rocket_toml.parent().is_some_and(Path::exists) { + if rocket_toml.file_name().is_none_or(|x| x != "Rocket.toml") || !rocket_toml.parent().is_some_and(Path::exists) { error!("invalid value for ROCKET_CONFIG"); warn!("hint: the filename must be 'Rocket.toml' and the parent folder must exist on the disk"); abort_misconfig(); diff --git a/server/central/src/web/routes/auth.rs b/server/central/src/web/routes/auth.rs index a72a1df1f..64c253f72 100644 --- a/server/central/src/web/routes/auth.rs +++ b/server/central/src/web/routes/auth.rs @@ -320,7 +320,7 @@ pub async fn challenge_verify( // verify trust token let trust_token = if let Ok(sm_key) = std::env::var("GLOBED_GS_SECURE_MODE_KEY") { if let Some(trust_token) = &post_data.0.trust_token { - let decrypted = String::from_utf8(decrypt_trust_token(&trust_token, &sm_key)?)?; + let decrypted = String::from_utf8(decrypt_trust_token(trust_token, &sm_key)?)?; if let Some((s_value, token_rest)) = decrypted.split_once('|') { if s_value != challenge.value { unauthorized!("security check failed: trust token value mismatch"); diff --git a/server/esp/src/common.rs b/server/esp/src/common.rs index c5648f220..20864aa94 100644 --- a/server/esp/src/common.rs +++ b/server/esp/src/common.rs @@ -10,11 +10,7 @@ use std::{ // this is bizarre const fn constmax(a: usize, b: usize) -> usize { - if a >= b { - a - } else { - b - } + if a >= b { a } else { b } } macro_rules! impl_primitive { @@ -153,7 +149,7 @@ where /* Cow<'a, T> */ -impl<'a, T: ?Sized + ToOwned> Encodable for Cow<'a, T> +impl Encodable for Cow<'_, T> where ::Owned: Encodable, T: Encodable, @@ -175,7 +171,7 @@ where } } -impl<'a, T: ?Sized + ToOwned> Decodable for Cow<'a, T> +impl Decodable for Cow<'_, T> where ::Owned: Decodable, T: Decodable, @@ -189,7 +185,7 @@ where } } -impl<'a, T: ?Sized + ToOwned> DynamicSize for Cow<'a, T> +impl DynamicSize for Cow<'_, T> where ::Owned: DynamicSize, T: DynamicSize, diff --git a/server/esp/src/lib.rs b/server/esp/src/lib.rs index 51d0ecdae..3023b3679 100644 --- a/server/esp/src/lib.rs +++ b/server/esp/src/lib.rs @@ -439,7 +439,7 @@ impl ByteBufferExtWrite for ByteBuffer { impl_extwrite!(encode); } -impl<'a> ByteBufferExtWrite for FastByteBuffer<'a> { +impl ByteBufferExtWrite for FastByteBuffer<'_> { impl_extwrite!(encode_fast); } @@ -447,7 +447,7 @@ impl ByteBufferExtRead for ByteBuffer { impl_extread!(decode); } -impl<'a> ByteBufferExtRead for ByteReader<'a> { +impl ByteBufferExtRead for ByteReader<'_> { impl_extread!(decode_from_reader); } diff --git a/server/game/src/bridge.rs b/server/game/src/bridge.rs index 67ec35b0d..fcdc2fa9f 100644 --- a/server/game/src/bridge.rs +++ b/server/game/src/bridge.rs @@ -7,14 +7,14 @@ use std::{ }; use esp::{ - size_of_types, ByteBuffer, ByteBufferExt, ByteBufferExtRead, ByteBufferExtWrite, ByteReader, Decodable, DecodeError, DynamicSize, Encodable, - FastVec, StaticSize, + ByteBuffer, ByteBufferExt, ByteBufferExtRead, ByteBufferExtWrite, ByteReader, Decodable, DecodeError, DynamicSize, Encodable, FastVec, + StaticSize, size_of_types, }; use globed_derive::{DynamicSize, Encodable}; use globed_shared::{ + GameServerBootData, MAX_SUPPORTED_PROTOCOL, SERVER_MAGIC, SERVER_MAGIC_LEN, ServerUserEntry, SyncMutex, TokenIssuer, UserLoginResponse, data::*, reqwest::{self, Response, StatusCode}, - GameServerBootData, ServerUserEntry, SyncMutex, TokenIssuer, UserLoginResponse, MAX_SUPPORTED_PROTOCOL, SERVER_MAGIC, SERVER_MAGIC_LEN, }; use crate::webhook::{self, *}; @@ -160,7 +160,7 @@ impl CentralBridge { // verify that the magic bytes match let valid_magic = reader .read_value_array::() - .map_or(false, |magic| magic.iter().eq(SERVER_MAGIC.iter())); + .is_ok_and(|magic| magic.iter().eq(SERVER_MAGIC.iter())); if !valid_magic { let txt = String::from_utf8(reader.as_bytes().to_vec()).unwrap_or_else(|_| "".to_owned()); @@ -377,6 +377,7 @@ impl CentralBridge { Ok(()) } + #[allow(clippy::too_many_arguments)] pub async fn send_webhook_message_for_action( &self, action: &AdminUserAction, diff --git a/server/game/src/data/mod.rs b/server/game/src/data/mod.rs index 2a107a32c..84b50ce05 100644 --- a/server/game/src/data/mod.rs +++ b/server/game/src/data/mod.rs @@ -6,9 +6,9 @@ pub use esp::*; pub use globed_derive::*; pub use globed_shared::MAX_NAME_SIZE; +pub use v_current::VERSION as CURRENT_PROTOCOL; pub use v_current::packets; pub use v_current::types; -pub use v_current::VERSION as CURRENT_PROTOCOL; pub use packets::*; pub use types::*; @@ -39,7 +39,7 @@ impl ByteBufferExtRead2 for ByteBuffer { } } -impl<'a> ByteBufferExtRead2 for ByteReader<'a> { +impl ByteBufferExtRead2 for ByteReader<'_> { #[inline] fn read_packet_header(&mut self) -> DecodeResult { self.read_value() @@ -73,7 +73,7 @@ impl ByteBufferExtWrite2 for ByteBuffer { } } -impl<'a> ByteBufferExtWrite2 for FastByteBuffer<'a> { +impl ByteBufferExtWrite2 for FastByteBuffer<'_> { #[inline] fn write_packet_header(&mut self) { self.write_value(&PacketHeader::from_packet::());