Browse Source

listen to supreme leader clippy in some places and silence him like the puppet he is in others

andy/update-rust
andy 7 months ago
parent
commit
5ba61cf461
  1. 4
      src/bin/patch.rs
  2. 8
      src/common/mainloop/interserver.rs
  3. 2
      src/ship/items/bank.rs
  4. 1
      src/ship/packet/builder/room.rs
  5. 4
      src/ship/shops/armor.rs
  6. 13
      src/ship/shops/tool.rs

4
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);
}

8
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
}
}
}

2
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<std::cmp::Ordering> {
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<std::cmp::Ordering> {
self.item.partial_cmp(&other.item)

1
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,

4
src/ship/shops/armor.rs

@ -342,8 +342,8 @@ impl<R: Rng + SeedableRng> ArmorShop<R> {
pub fn generate_armor_list(&mut self, character_level: usize) -> Vec<ArmorShopItem> {
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()
}
}

13
src/ship/shops/tool.rs

@ -36,16 +36,7 @@ impl Ord for ToolShopItem {
impl PartialOrd for ToolShopItem {
fn partial_cmp(&self, other: &ToolShopItem) -> Option<std::cmp::Ordering> {
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<R: Rng + SeedableRng> ToolShop<R> {
pub fn generate_tool_list(&mut self, character_level: usize) -> Vec<ToolShopItem> {
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::<Vec<_>>();
tools.sort();
tools

Loading…
Cancel
Save