From 5ba61cf461e5e37c7a42a3df97c157fc38c00115 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 24 Oct 2023 19:45:46 -0300 Subject: [PATCH] listen to supreme leader clippy in some places and silence him like the puppet he is in others --- src/bin/patch.rs | 4 +--- src/common/mainloop/interserver.rs | 8 ++------ src/ship/items/bank.rs | 2 ++ src/ship/packet/builder/room.rs | 1 + src/ship/shops/armor.rs | 4 ++-- src/ship/shops/tool.rs | 13 ++----------- 6 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/bin/patch.rs b/src/bin/patch.rs index e7304d8..6716391 100644 --- a/src/bin/patch.rs +++ b/src/bin/patch.rs @@ -12,7 +12,5 @@ fn main() { elseware::common::mainloop::run_server(patch_state, patch_config.port).await; }); - async_std::task::block_on(async move { - patch_loop.await - }); + async_std::task::block_on(patch_loop); } diff --git a/src/common/mainloop/interserver.rs b/src/common/mainloop/interserver.rs index dbe940d..cc1358e 100644 --- a/src/common/mainloop/interserver.rs +++ b/src/common/mainloop/interserver.rs @@ -220,12 +220,8 @@ where let mut buf = [0u8; 1]; loop { let peek = socket.peek(&mut buf).await; - match peek { - Ok(len) if len == 0 => { - break - }, - _ => { - } + if let Ok(0) = peek { + break } } } diff --git a/src/ship/items/bank.rs b/src/ship/items/bank.rs index 73f0e10..8b63a47 100644 --- a/src/ship/items/bank.rs +++ b/src/ship/items/bank.rs @@ -323,6 +323,7 @@ impl std::cmp::PartialEq for BankItemDetail { impl std::cmp::Eq for BankItemDetail {} +#[allow(clippy::non_canonical_partial_ord_impl)] impl std::cmp::PartialOrd for BankItemDetail { fn partial_cmp(&self, other: &BankItemDetail) -> Option { let mut self_bytes = [0u8; 4]; @@ -360,6 +361,7 @@ impl std::cmp::PartialEq for BankItem { impl std::cmp::Eq for BankItem {} +#[allow(clippy::non_canonical_partial_ord_impl)] impl std::cmp::PartialOrd for BankItem { fn partial_cmp(&self, other: &BankItem) -> Option { self.item.partial_cmp(&other.item) diff --git a/src/ship/packet/builder/room.rs b/src/ship/packet/builder/room.rs index 2b5c8e5..113fe70 100644 --- a/src/ship/packet/builder/room.rs +++ b/src/ship/packet/builder/room.rs @@ -9,6 +9,7 @@ use std::convert::TryInto; use futures::stream::StreamExt; +#[allow(clippy::manual_try_fold)] pub async fn join_room(id: ClientId, clients: &Clients, client_location: &ClientLocation, diff --git a/src/ship/shops/armor.rs b/src/ship/shops/armor.rs index d1d8b47..64d1688 100644 --- a/src/ship/shops/armor.rs +++ b/src/ship/shops/armor.rs @@ -342,8 +342,8 @@ impl ArmorShop { pub fn generate_armor_list(&mut self, character_level: usize) -> Vec { self.generate_frame_list(character_level).into_iter() - .chain(self.generate_barrier_list(character_level).into_iter()) - .chain(self.generate_unit_list(character_level).into_iter()) + .chain(self.generate_barrier_list(character_level)) + .chain(self.generate_unit_list(character_level)) .collect() } } diff --git a/src/ship/shops/tool.rs b/src/ship/shops/tool.rs index b5f9718..aabba9e 100644 --- a/src/ship/shops/tool.rs +++ b/src/ship/shops/tool.rs @@ -36,16 +36,7 @@ impl Ord for ToolShopItem { impl PartialOrd for ToolShopItem { fn partial_cmp(&self, other: &ToolShopItem) -> Option { - let a = match self { - ToolShopItem::Tool(t) => Tool{tool : *t}.as_individual_bytes(), - ToolShopItem::Tech(t) => t.as_bytes(), - }; - let b = match other { - ToolShopItem::Tool(t) => Tool{tool : *t}.as_individual_bytes(), - ToolShopItem::Tech(t) => t.as_bytes(), - }; - - a.partial_cmp(&b) + Some(self.cmp(other)) } } @@ -285,7 +276,7 @@ impl ToolShop { pub fn generate_tool_list(&mut self, character_level: usize) -> Vec { let mut tools = Vec::new().into_iter() .chain(self.tools.0.clone().into_iter().map(ToolShopItem::Tool)) - .chain(self.generate_techs(character_level).into_iter()) + .chain(self.generate_techs(character_level)) .collect::>(); tools.sort(); tools