From 2290efd21979ab8ef962690d256780ad561ad98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Mon, 19 Oct 2020 00:57:43 +0200 Subject: [PATCH] remove clippy warnings no longer needed --- server/src/sys/msg/character_screen.rs | 16 +++++----------- server/src/sys/msg/general.rs | 16 +++++----------- server/src/sys/msg/in_game.rs | 14 ++++---------- server/src/sys/msg/ping.rs | 5 +---- server/src/sys/msg/register.rs | 14 ++++---------- 5 files changed, 19 insertions(+), 46 deletions(-) diff --git a/server/src/sys/msg/character_screen.rs b/server/src/sys/msg/character_screen.rs index 8444886a62..4c344a5007 100644 --- a/server/src/sys/msg/character_screen.rs +++ b/server/src/sys/msg/character_screen.rs @@ -128,7 +128,7 @@ impl Sys { /// This system will handle new messages from clients pub struct Sys; impl<'a> System<'a> for Sys { - #[allow(clippy::type_complexity)] // TODO: Pending review in #587 + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, EventBus>, @@ -144,9 +144,6 @@ impl<'a> System<'a> for Sys { ReadExpect<'a, AliasValidator>, ); - #[allow(clippy::match_ref_pats)] // TODO: Pending review in #587 - #[allow(clippy::single_char_pattern)] // TODO: Pending review in #587 - #[allow(clippy::single_match)] // TODO: Pending review in #587 fn run( &mut self, ( @@ -196,19 +193,16 @@ impl<'a> System<'a> for Sys { ) }); - match res { - Ok(1_u64..=u64::MAX) => { - // Update client ping. - client.last_ping = time.0 - }, - _ => (/*handled by ping*/), + if let Ok(1_u64..=u64::MAX) = res { + // Update client ping. + client.last_ping = time.0 } } // Handle new chat messages. for (entity, msg) in new_chat_msgs { // Handle chat commands. - if msg.message.starts_with("/") { + if msg.message.starts_with('/') { if let (Some(entity), true) = (entity, msg.message.len() > 1) { let argv = String::from(&msg.message[1..]); server_emitter.emit(ServerEvent::ChatCmd(entity, argv)); diff --git a/server/src/sys/msg/general.rs b/server/src/sys/msg/general.rs index 19a2fb2dd6..a583a76805 100644 --- a/server/src/sys/msg/general.rs +++ b/server/src/sys/msg/general.rs @@ -72,7 +72,7 @@ impl Sys { /// This system will handle new messages from clients pub struct Sys; impl<'a> System<'a> for Sys { - #[allow(clippy::type_complexity)] // TODO: Pending review in #587 + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, EventBus>, @@ -85,9 +85,6 @@ impl<'a> System<'a> for Sys { WriteStorage<'a, GeneralStream>, ); - #[allow(clippy::match_ref_pats)] // TODO: Pending review in #587 - #[allow(clippy::single_char_pattern)] // TODO: Pending review in #587 - #[allow(clippy::single_match)] // TODO: Pending review in #587 fn run( &mut self, ( @@ -125,19 +122,16 @@ impl<'a> System<'a> for Sys { ) }); - match res { - Ok(1_u64..=u64::MAX) => { - // Update client ping. - client.last_ping = time.0 - }, - _ => (/*handled by ping*/), + if let Ok(1_u64..=u64::MAX) = res { + // Update client ping. + client.last_ping = time.0 } } // Handle new chat messages. for (entity, msg) in new_chat_msgs { // Handle chat commands. - if msg.message.starts_with("/") { + if msg.message.starts_with('/') { if let (Some(entity), true) = (entity, msg.message.len() > 1) { let argv = String::from(&msg.message[1..]); server_emitter.emit(ServerEvent::ChatCmd(entity, argv)); diff --git a/server/src/sys/msg/in_game.rs b/server/src/sys/msg/in_game.rs index ed3356d38a..0b8ffa8e46 100644 --- a/server/src/sys/msg/in_game.rs +++ b/server/src/sys/msg/in_game.rs @@ -177,7 +177,7 @@ impl Sys { /// This system will handle new messages from clients pub struct Sys; impl<'a> System<'a> for Sys { - #[allow(clippy::type_complexity)] // TODO: Pending review in #587 + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, EventBus>, @@ -199,9 +199,6 @@ impl<'a> System<'a> for Sys { Read<'a, Settings>, ); - #[allow(clippy::match_ref_pats)] // TODO: Pending review in #587 - #[allow(clippy::single_char_pattern)] // TODO: Pending review in #587 - #[allow(clippy::single_match)] // TODO: Pending review in #587 fn run( &mut self, ( @@ -255,12 +252,9 @@ impl<'a> System<'a> for Sys { ) }); - match res { - Ok(1_u64..=u64::MAX) => { - // Update client ping. - client.last_ping = time.0 - }, - _ => (/*handled by ping*/), + if let Ok(1_u64..=u64::MAX) = res { + // Update client ping. + client.last_ping = time.0 } } diff --git a/server/src/sys/msg/ping.rs b/server/src/sys/msg/ping.rs index b5b93bdc66..68be90ffc0 100644 --- a/server/src/sys/msg/ping.rs +++ b/server/src/sys/msg/ping.rs @@ -30,7 +30,7 @@ impl Sys { /// This system will handle new messages from clients pub struct Sys; impl<'a> System<'a> for Sys { - #[allow(clippy::type_complexity)] // TODO: Pending review in #587 + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, EventBus>, @@ -42,9 +42,6 @@ impl<'a> System<'a> for Sys { Read<'a, Settings>, ); - #[allow(clippy::match_ref_pats)] // TODO: Pending review in #587 - #[allow(clippy::single_char_pattern)] // TODO: Pending review in #587 - #[allow(clippy::single_match)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/server/src/sys/msg/register.rs b/server/src/sys/msg/register.rs index 437243ab52..f08541990d 100644 --- a/server/src/sys/msg/register.rs +++ b/server/src/sys/msg/register.rs @@ -90,7 +90,7 @@ impl Sys { /// This system will handle new messages from clients pub struct Sys; impl<'a> System<'a> for Sys { - #[allow(clippy::type_complexity)] // TODO: Pending review in #587 + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, Time>, @@ -107,9 +107,6 @@ impl<'a> System<'a> for Sys { ReadExpect<'a, EditableSettings>, ); - #[allow(clippy::match_ref_pats)] // TODO: Pending review in #587 - #[allow(clippy::single_char_pattern)] // TODO: Pending review in #587 - #[allow(clippy::single_match)] // TODO: Pending review in #587 fn run( &mut self, ( @@ -174,12 +171,9 @@ impl<'a> System<'a> for Sys { ) }); - match res { - Ok(1_u64..=u64::MAX) => { - // Update client ping. - client.last_ping = time.0 - }, - _ => (/*handled by ping*/), + if let Ok(1_u64..=u64::MAX) = res { + // Update client ping. + client.last_ping = time.0 } }