From 4ea333f16b11808f48798cf80de7e844e6fdae0e Mon Sep 17 00:00:00 2001 From: Cain Date: Sun, 22 Feb 2026 17:47:05 +0000 Subject: [PATCH] fix(clippy): add lifetime annotations to various methods and structs (mismatched_lifetime_syntaxes) --- crates/id-tests/src/lib.rs | 2 +- crates/lib/src/games/eco/types.rs | 4 ++-- crates/lib/src/games/ffow/types.rs | 2 +- crates/lib/src/games/jc2m/types.rs | 4 ++-- crates/lib/src/games/mindustry/types.rs | 2 +- crates/lib/src/games/minecraft/types.rs | 6 +++--- crates/lib/src/games/savage2/types.rs | 2 +- crates/lib/src/games/theship/types.rs | 4 ++-- crates/lib/src/protocols/gamespy/protocols/one/types.rs | 4 ++-- crates/lib/src/protocols/gamespy/protocols/three/types.rs | 4 ++-- crates/lib/src/protocols/gamespy/protocols/two/types.rs | 4 ++-- crates/lib/src/protocols/quake/one.rs | 4 ++-- crates/lib/src/protocols/quake/two.rs | 4 ++-- crates/lib/src/protocols/quake/types.rs | 4 ++-- crates/lib/src/protocols/types.rs | 8 ++++---- crates/lib/src/protocols/unreal2/types.rs | 4 ++-- crates/lib/src/protocols/valve/types.rs | 4 ++-- 17 files changed, 33 insertions(+), 33 deletions(-) diff --git a/crates/id-tests/src/lib.rs b/crates/id-tests/src/lib.rs index e9fb770..f0fe155 100644 --- a/crates/id-tests/src/lib.rs +++ b/crates/id-tests/src/lib.rs @@ -244,7 +244,7 @@ pub struct GameNameParsed<'a> { year: Option, } -pub fn extract_game_parts_from_name(game: &str) -> GameNameParsed { +pub fn extract_game_parts_from_name(game: &str) -> GameNameParsed<'_> { // Separate game name into words // NOTE: we have to leave "-" in to prevent hyphenated prefixes being parsed as // numerals diff --git a/crates/lib/src/games/eco/types.rs b/crates/lib/src/games/eco/types.rs index 77e050b..be3af6f 100644 --- a/crates/lib/src/games/eco/types.rs +++ b/crates/lib/src/games/eco/types.rs @@ -98,7 +98,7 @@ pub struct Player { } impl CommonPlayer for Player { - fn as_original(&self) -> crate::protocols::types::GenericPlayer { + fn as_original(&self) -> crate::protocols::types::GenericPlayer<'_> { crate::protocols::types::GenericPlayer::Eco(self) } @@ -201,7 +201,7 @@ impl From for Response { } impl CommonResponse for Response { - fn as_original(&self) -> crate::protocols::GenericResponse { crate::protocols::GenericResponse::Eco(self) } + fn as_original(&self) -> crate::protocols::GenericResponse<'_> { crate::protocols::GenericResponse::Eco(self) } fn players_online(&self) -> u32 { self.players_online } diff --git a/crates/lib/src/games/ffow/types.rs b/crates/lib/src/games/ffow/types.rs index 4a8d852..c66ff48 100644 --- a/crates/lib/src/games/ffow/types.rs +++ b/crates/lib/src/games/ffow/types.rs @@ -43,7 +43,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::FFOW(self) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::FFOW(self) } fn name(&self) -> Option<&str> { Some(&self.name) } fn game_mode(&self) -> Option<&str> { Some(&self.game_mode) } diff --git a/crates/lib/src/games/jc2m/types.rs b/crates/lib/src/games/jc2m/types.rs index 0f14a58..6bfcb86 100644 --- a/crates/lib/src/games/jc2m/types.rs +++ b/crates/lib/src/games/jc2m/types.rs @@ -12,7 +12,7 @@ pub struct Player { } impl CommonPlayer for Player { - fn as_original(&self) -> GenericPlayer { GenericPlayer::JCMP2(self) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::JCMP2(self) } fn name(&self) -> &str { &self.name } } @@ -30,7 +30,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::JC2M(self) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::JC2M(self) } fn game_version(&self) -> Option<&str> { Some(&self.game_version) } fn description(&self) -> Option<&str> { Some(&self.description) } diff --git a/crates/lib/src/games/mindustry/types.rs b/crates/lib/src/games/mindustry/types.rs index 0bbf61d..436d5b5 100644 --- a/crates/lib/src/games/mindustry/types.rs +++ b/crates/lib/src/games/mindustry/types.rs @@ -64,7 +64,7 @@ impl GameMode { } impl CommonResponse for ServerData { - fn as_original(&self) -> GenericResponse { GenericResponse::Mindustry(self) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::Mindustry(self) } fn players_online(&self) -> u32 { self.players.try_into().unwrap_or(0) } fn players_maximum(&self) -> u32 { self.player_limit.try_into().unwrap_or(0) } diff --git a/crates/lib/src/games/minecraft/types.rs b/crates/lib/src/games/minecraft/types.rs index d66898d..aa15c8a 100644 --- a/crates/lib/src/games/minecraft/types.rs +++ b/crates/lib/src/games/minecraft/types.rs @@ -49,7 +49,7 @@ pub struct Player { } impl CommonPlayer for Player { - fn as_original(&self) -> GenericPlayer { GenericPlayer::Minecraft(self) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::Minecraft(self) } fn name(&self) -> &str { &self.name } } @@ -134,7 +134,7 @@ impl From for RequestSettings { } impl CommonResponse for JavaResponse { - fn as_original(&self) -> GenericResponse { GenericResponse::Minecraft(VersionedResponse::Java(self)) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::Minecraft(VersionedResponse::Java(self)) } fn description(&self) -> Option<&str> { Some(&self.description) } fn players_maximum(&self) -> u32 { self.players_maximum } @@ -175,7 +175,7 @@ pub struct BedrockResponse { } impl CommonResponse for BedrockResponse { - fn as_original(&self) -> GenericResponse { GenericResponse::Minecraft(VersionedResponse::Bedrock(self)) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::Minecraft(VersionedResponse::Bedrock(self)) } fn name(&self) -> Option<&str> { Some(&self.name) } fn map(&self) -> Option<&str> { self.map.as_deref() } diff --git a/crates/lib/src/games/savage2/types.rs b/crates/lib/src/games/savage2/types.rs index ceedd98..0016bfd 100644 --- a/crates/lib/src/games/savage2/types.rs +++ b/crates/lib/src/games/savage2/types.rs @@ -20,7 +20,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::Savage2(self) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::Savage2(self) } fn name(&self) -> Option<&str> { Some(&self.name) } fn game_mode(&self) -> Option<&str> { Some(&self.game_mode) } diff --git a/crates/lib/src/games/theship/types.rs b/crates/lib/src/games/theship/types.rs index 9df679c..8bb593c 100644 --- a/crates/lib/src/games/theship/types.rs +++ b/crates/lib/src/games/theship/types.rs @@ -31,7 +31,7 @@ impl TheShipPlayer { } impl CommonPlayer for TheShipPlayer { - fn as_original(&self) -> GenericPlayer { GenericPlayer::TheShip(self) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::TheShip(self) } fn name(&self) -> &str { &self.name } fn score(&self) -> Option { Some(self.score) } @@ -64,7 +64,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::TheShip(self) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::TheShip(self) } fn name(&self) -> Option<&str> { Some(&self.name) } fn map(&self) -> Option<&str> { Some(&self.map) } diff --git a/crates/lib/src/protocols/gamespy/protocols/one/types.rs b/crates/lib/src/protocols/gamespy/protocols/one/types.rs index aab764c..6344d39 100644 --- a/crates/lib/src/protocols/gamespy/protocols/one/types.rs +++ b/crates/lib/src/protocols/gamespy/protocols/one/types.rs @@ -25,7 +25,7 @@ pub struct Player { } impl CommonPlayer for Player { - fn as_original(&self) -> GenericPlayer { GenericPlayer::Gamespy(VersionedPlayer::One(self)) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::Gamespy(VersionedPlayer::One(self)) } fn name(&self) -> &str { &self.name } fn score(&self) -> Option { Some(self.score) } @@ -52,7 +52,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::GameSpy(VersionedResponse::One(self)) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::GameSpy(VersionedResponse::One(self)) } fn name(&self) -> Option<&str> { Some(&self.name) } fn map(&self) -> Option<&str> { Some(&self.map) } diff --git a/crates/lib/src/protocols/gamespy/protocols/three/types.rs b/crates/lib/src/protocols/gamespy/protocols/three/types.rs index bfb8858..db53ada 100644 --- a/crates/lib/src/protocols/gamespy/protocols/three/types.rs +++ b/crates/lib/src/protocols/gamespy/protocols/three/types.rs @@ -19,7 +19,7 @@ pub struct Player { } impl CommonPlayer for Player { - fn as_original(&self) -> crate::protocols::types::GenericPlayer { + fn as_original(&self) -> crate::protocols::types::GenericPlayer<'_> { GenericPlayer::Gamespy(VersionedPlayer::Three(self)) } @@ -54,7 +54,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::GameSpy(VersionedResponse::Three(self)) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::GameSpy(VersionedResponse::Three(self)) } fn name(&self) -> Option<&str> { Some(&self.name) } fn map(&self) -> Option<&str> { Some(&self.map) } diff --git a/crates/lib/src/protocols/gamespy/protocols/two/types.rs b/crates/lib/src/protocols/gamespy/protocols/two/types.rs index cbff535..e99c33c 100644 --- a/crates/lib/src/protocols/gamespy/protocols/two/types.rs +++ b/crates/lib/src/protocols/gamespy/protocols/two/types.rs @@ -24,7 +24,7 @@ pub struct Player { } impl CommonPlayer for Player { - fn as_original(&self) -> GenericPlayer { GenericPlayer::Gamespy(VersionedPlayer::Two(self)) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::Gamespy(VersionedPlayer::Two(self)) } fn name(&self) -> &str { &self.name } fn score(&self) -> Option { Some(self.score.into()) } @@ -45,7 +45,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::GameSpy(VersionedResponse::Two(self)) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::GameSpy(VersionedResponse::Two(self)) } fn name(&self) -> Option<&str> { Some(&self.name) } fn map(&self) -> Option<&str> { Some(&self.map) } diff --git a/crates/lib/src/protocols/quake/one.rs b/crates/lib/src/protocols/quake/one.rs index 528b841..b25a018 100644 --- a/crates/lib/src/protocols/quake/one.rs +++ b/crates/lib/src/protocols/quake/one.rs @@ -26,11 +26,11 @@ pub struct Player { } impl QuakePlayerType for Player { - fn version(response: &Response) -> super::VersionedResponse { super::VersionedResponse::One(response) } + fn version(response: &Response) -> super::VersionedResponse<'_> { super::VersionedResponse::One(response) } } impl CommonPlayer for Player { - fn as_original(&self) -> GenericPlayer { GenericPlayer::QuakeOne(self) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::QuakeOne(self) } fn name(&self) -> &str { &self.name } fn score(&self) -> Option { Some(self.score.into()) } diff --git a/crates/lib/src/protocols/quake/two.rs b/crates/lib/src/protocols/quake/two.rs index d70daa4..c6491f2 100644 --- a/crates/lib/src/protocols/quake/two.rs +++ b/crates/lib/src/protocols/quake/two.rs @@ -22,13 +22,13 @@ pub struct Player { } impl QuakePlayerType for Player { - fn version(response: &Response) -> super::VersionedResponse { + fn version(response: &Response) -> super::VersionedResponse<'_> { super::VersionedResponse::TwoAndThree(response) } } impl CommonPlayer for Player { - fn as_original(&self) -> GenericPlayer { GenericPlayer::QuakeTwo(self) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::QuakeTwo(self) } fn name(&self) -> &str { &self.name } diff --git a/crates/lib/src/protocols/quake/types.rs b/crates/lib/src/protocols/quake/types.rs index 4dc06ec..6e72ed3 100644 --- a/crates/lib/src/protocols/quake/types.rs +++ b/crates/lib/src/protocols/quake/types.rs @@ -28,11 +28,11 @@ pub struct Response

{ } pub trait QuakePlayerType: Sized + CommonPlayer { - fn version(response: &Response) -> VersionedResponse; + fn version(response: &Response) -> VersionedResponse<'_>; } impl CommonResponse for Response

{ - fn as_original(&self) -> GenericResponse { GenericResponse::Quake(P::version(self)) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::Quake(P::version(self)) } fn name(&self) -> Option<&str> { Some(&self.name) } fn game_version(&self) -> Option<&str> { self.game_version.as_deref() } diff --git a/crates/lib/src/protocols/types.rs b/crates/lib/src/protocols/types.rs index a86b1c6..501321b 100644 --- a/crates/lib/src/protocols/types.rs +++ b/crates/lib/src/protocols/types.rs @@ -104,10 +104,10 @@ pub enum GenericPlayer<'a> { pub trait CommonResponse { /// Get the original response type - fn as_original(&self) -> GenericResponse; + fn as_original(&self) -> GenericResponse<'_>; /// Get a struct that can be stored as JSON (you don't need to override /// this) - fn as_json(&self) -> CommonResponseJson { + fn as_json(&self) -> CommonResponseJson<'_> { CommonResponseJson { name: self.name(), description: self.description(), @@ -163,10 +163,10 @@ pub struct CommonResponseJson<'a> { pub trait CommonPlayer { /// Get the original player type - fn as_original(&self) -> GenericPlayer; + fn as_original(&self) -> GenericPlayer<'_>; /// Get a struct that can be stored as JSON (you don't need to override /// this) - fn as_json(&self) -> CommonPlayerJson { + fn as_json(&self) -> CommonPlayerJson<'_> { CommonPlayerJson { name: self.name(), score: self.score(), diff --git a/crates/lib/src/protocols/unreal2/types.rs b/crates/lib/src/protocols/unreal2/types.rs index 47404e8..96316be 100644 --- a/crates/lib/src/protocols/unreal2/types.rs +++ b/crates/lib/src/protocols/unreal2/types.rs @@ -167,7 +167,7 @@ impl CommonPlayer for Player { fn score(&self) -> Option { Some(self.score) } - fn as_original(&self) -> GenericPlayer { GenericPlayer::Unreal2(self) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::Unreal2(self) } } /// Unreal 2 response. @@ -180,7 +180,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::Unreal2(self) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::Unreal2(self) } fn name(&self) -> Option<&str> { Some(&self.server_info.name) } diff --git a/crates/lib/src/protocols/valve/types.rs b/crates/lib/src/protocols/valve/types.rs index ffa7abf..46629ab 100644 --- a/crates/lib/src/protocols/valve/types.rs +++ b/crates/lib/src/protocols/valve/types.rs @@ -58,7 +58,7 @@ pub struct Response { } impl CommonResponse for Response { - fn as_original(&self) -> GenericResponse { GenericResponse::Valve(self) } + fn as_original(&self) -> GenericResponse<'_> { GenericResponse::Valve(self) } fn name(&self) -> Option<&str> { Some(&self.info.name) } fn game_mode(&self) -> Option<&str> { Some(&self.info.game_mode) } @@ -135,7 +135,7 @@ pub struct ServerPlayer { } impl CommonPlayer for ServerPlayer { - fn as_original(&self) -> GenericPlayer { GenericPlayer::Valve(self) } + fn as_original(&self) -> GenericPlayer<'_> { GenericPlayer::Valve(self) } fn name(&self) -> &str { &self.name } fn score(&self) -> Option { Some(self.score) } }