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