From 0c074e45eed17602bc91cbd7e42c88d1c182a4a9 Mon Sep 17 00:00:00 2001 From: jake Date: Sat, 18 Feb 2023 17:55:07 -0700 Subject: [PATCH] clippy --- src/entity/room.rs | 30 +----------------------------- src/ship/items/actions.rs | 1 - src/ship/items/tasks.rs | 4 ++-- src/ship/packet/handler/quest.rs | 2 +- src/ship/packet/handler/room.rs | 3 ++- src/ship/room.rs | 4 ++-- src/ship/ship.rs | 2 +- 7 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/entity/room.rs b/src/entity/room.rs index d59327e..a5eeea4 100644 --- a/src/entity/room.rs +++ b/src/entity/room.rs @@ -2,7 +2,7 @@ use serde::{Serialize, Deserialize}; use crate::entity::character::{CharacterEntityId, SectionID}; -use crate::ship::room::{Episode, Difficulty, RoomMode}; +use crate::ship::room::{Episode, Difficulty}; #[derive(PartialEq, Eq, Copy, Clone, Debug, Hash, PartialOrd, Ord, Serialize, Deserialize)] @@ -62,34 +62,6 @@ pub struct NewRoomEntity { pub difficulty: Difficulty, } -impl NewRoomEntity { - fn new(name: String, section_id: SectionID, mode: RoomMode) -> NewRoomEntity { - NewRoomEntity { - name: name, - section_id: section_id, - mode: match mode { - RoomMode::Single {..} => RoomEntityMode::Single, - RoomMode::Multi {..} => RoomEntityMode::Multi, - RoomMode::Challenge {..} => RoomEntityMode::Challenge, - RoomMode::Battle {..} => RoomEntityMode::Battle, - }, - episode: match mode { - RoomMode::Single { episode, .. } => episode, - RoomMode::Multi { episode, ..} => episode , - RoomMode::Challenge { episode, ..} => episode, - RoomMode::Battle { episode, ..} => episode, - }, - difficulty: match mode { - RoomMode::Single { difficulty, .. } => difficulty, - RoomMode::Multi { difficulty, ..} => difficulty , - RoomMode::Challenge {..} => Difficulty::Normal, - RoomMode::Battle { difficulty, ..} => difficulty, - }, - } - } -} - - #[derive(Debug, Copy, Clone, Serialize)] pub enum RoomNote { Create { diff --git a/src/ship/items/actions.rs b/src/ship/items/actions.rs index ad36f52..849ad0d 100644 --- a/src/ship/items/actions.rs +++ b/src/ship/items/actions.rs @@ -909,7 +909,6 @@ where pub(super) fn convert_item_drop_to_floor_item<'a, EG, TR>( - character_id: CharacterEntityId, item_drop: ItemDrop, ) -> impl Fn((ItemStateProxy, TR), ()) -> BoxFuture<'a, Result<((ItemStateProxy, TR), FloorItem), anyhow::Error>> + Clone diff --git a/src/ship/items/tasks.rs b/src/ship/items/tasks.rs index d8603f0..0c3f948 100644 --- a/src/ship/items/tasks.rs +++ b/src/ship/items/tasks.rs @@ -477,7 +477,7 @@ where entity_gateway.with_transaction(move |transaction| async move { let item_state_proxy = ItemStateProxy::new(item_state.clone()); let ((item_state_proxy, transaction), floor_item) = ItemStateAction::default() - .act(actions::convert_item_drop_to_floor_item(character_id, item_drop)) + .act(actions::convert_item_drop_to_floor_item(item_drop)) .act(actions::item_note_enemy_drop(character_id, room_id, monster_type)) .act(actions::add_item_to_local_floor(character_id)) .commit((item_state_proxy, transaction)) @@ -501,7 +501,7 @@ where entity_gateway.with_transaction(move |transaction| async move { let item_state_proxy = ItemStateProxy::new(item_state.clone()); let ((item_state_proxy, transaction), floor_item) = ItemStateAction::default() - .act(actions::convert_item_drop_to_floor_item(character_id, item_drop)) + .act(actions::convert_item_drop_to_floor_item(item_drop)) .act(actions::item_note_box_drop(character_id, room_id)) .act(actions::add_item_to_local_floor(character_id)) .commit((item_state_proxy, transaction)) diff --git a/src/ship/packet/handler/quest.rs b/src/ship/packet/handler/quest.rs index 3dee2ff..1c8c31e 100644 --- a/src/ship/packet/handler/quest.rs +++ b/src/ship/packet/handler/quest.rs @@ -3,7 +3,7 @@ use futures::stream::{FuturesOrdered, StreamExt}; use libpso::packet::ship::*; use crate::common::serverstate::ClientId; use crate::ship::ship::{SendShipPacket, ShipError, Clients, ShipEvent}; -use crate::ship::room::{Rooms, QuestCategoryType}; +use crate::ship::room::Rooms; use crate::ship::map::enemy::RareMonsterAppearTable; use crate::ship::location::{ClientLocation}; use crate::ship::packet::builder::quest; diff --git a/src/ship/packet/handler/room.rs b/src/ship/packet/handler/room.rs index 466a58a..9198c63 100644 --- a/src/ship/packet/handler/room.rs +++ b/src/ship/packet/handler/room.rs @@ -9,7 +9,7 @@ use crate::common::serverstate::ClientId; use crate::common::leveltable::LEVEL_TABLE; use crate::entity::gateway::EntityGateway; use crate::entity::character::SectionID; -use crate::entity::room::{RoomEntity, RoomEntityId, NewRoomEntity, RoomEntityMode, RoomNote}; +use crate::entity::room::{NewRoomEntity, RoomEntityMode, RoomNote}; use crate::ship::drops::DropTable; use crate::ship::ship::{SendShipPacket, Clients, ShipEvent}; use crate::ship::room::{Rooms, Episode, Difficulty, RoomState, RoomMode}; @@ -124,6 +124,7 @@ pub async fn room_name_request(id: ClientId, } } +#[allow(clippy::too_many_arguments)] pub async fn join_room(id: ClientId, pkt: MenuSelect, entity_gateway: &mut EG, diff --git a/src/ship/room.rs b/src/ship/room.rs index 69820b1..b3a03c2 100644 --- a/src/ship/room.rs +++ b/src/ship/room.rs @@ -1,6 +1,5 @@ use std::collections::HashMap; -use std::convert::{From, Into, TryFrom, TryInto}; -use std::path::PathBuf; +use std::convert::{From, Into, TryFrom}; use async_std::sync::{Arc, RwLock, RwLockReadGuard}; use futures::future::BoxFuture; use futures::stream::{FuturesOrdered, Stream}; @@ -361,6 +360,7 @@ impl RoomState { } } + #[allow(clippy::too_many_arguments)] pub fn new (room_id: RoomEntityId, mode: RoomEntityMode, episode: Episode, diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 932f4f9..cd40965 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -859,7 +859,7 @@ impl ServerState for ShipServerState { let mut entity_gateway = self.entity_gateway.clone(); Box::pin(async move { entity_gateway.add_room_note(room.room_id, RoomNote::PlayerJoin { - character_id: character_id, + character_id, }).await })}).await; if neighbors.is_empty() {