Browse Source

clippy cleanup

pull/135/head
jake 1 year ago
committed by andy
parent
commit
cf2bac4ccb
  1. 6
      client/src/client.rs
  2. 6
      items/src/actions.rs
  3. 2
      items/src/tasks.rs
  4. 2
      room/Cargo.toml
  5. 8
      room/src/room.rs
  6. 2
      src/bin/main.rs
  7. 12
      src/ship/mod.rs

6
client/src/client.rs

@ -52,7 +52,7 @@ impl Clients {
.await; .await;
let client = clients let client = clients
.get(&client_id) .get(&client_id)
.ok_or_else(|| ClientError::NotFound(client_id))?
.ok_or(ClientError::NotFound(client_id))?
.read() .read()
.await; .await;
@ -75,7 +75,7 @@ impl Clients {
for (cindex, client_id) in client_ids.iter().enumerate() { for (cindex, client_id) in client_ids.iter().enumerate() {
let c = clients let c = clients
.get(client_id) .get(client_id)
.ok_or_else(|| ClientError::NotFound(*client_id))?
.ok_or(ClientError::NotFound(*client_id))?
.read() .read()
.await; .await;
client_states[cindex].write(c); client_states[cindex].write(c);
@ -101,7 +101,7 @@ impl Clients {
.await; .await;
let mut client = clients let mut client = clients
.get(&client_id) .get(&client_id)
.ok_or_else(|| ClientError::NotFound(client_id))?
.ok_or(ClientError::NotFound(client_id))?
.write() .write()
.await; .await;

6
items/src/actions.rs

@ -8,7 +8,6 @@ use std::pin::Pin;
use std::iter::IntoIterator; use std::iter::IntoIterator;
use anyhow::Context; use anyhow::Context;
use libpso::packet::{ship::Message, messages::GameMessage};
use entity::character::{CharacterEntity, CharacterEntityId}; use entity::character::{CharacterEntity, CharacterEntityId};
use entity::gateway::{EntityGateway, EntityGatewayTransaction}; use entity::gateway::{EntityGateway, EntityGatewayTransaction};
use entity::item::{ItemDetail, NewItemEntity, TradeId, ItemModifier}; use entity::item::{ItemDetail, NewItemEntity, TradeId, ItemModifier};
@ -22,7 +21,6 @@ use crate::floor::{FloorItem, FloorItemDetail};
use crate::apply_item::{apply_item, ApplyItemAction}; use crate::apply_item::{apply_item, ApplyItemAction};
use shops::ShopItem; use shops::ShopItem;
use drops::{ItemDrop, ItemDropType}; use drops::{ItemDrop, ItemDropType};
//use crate::ship::packet::builder;
use location::AreaClient; use location::AreaClient;
use maps::monster::MonsterType; use maps::monster::MonsterType;
@ -1166,8 +1164,7 @@ where
let (inventory_item_detail, create_item) = if item_detail.is_stackable() { let (inventory_item_detail, create_item) = if item_detail.is_stackable() {
let tool = item_detail.as_tool().ok_or_else(|| ItemStateError::NotATool(ClientItemId(0xFFFFFFFF)))?; let tool = item_detail.as_tool().ok_or_else(|| ItemStateError::NotATool(ClientItemId(0xFFFFFFFF)))?;
//let create_item = builder::message::create_stacked_item(area_client, item_id, &tool, 1).map_err(|_err| ItemStateError::Dummy)?;
let create_item = CreateItem::Stacked(area_client, item_id, tool.clone(), 1);
let create_item = CreateItem::Stacked(area_client, item_id, tool, 1);
let item_detail = StackedItemDetail { let item_detail = StackedItemDetail {
entity_ids: vec![new_item.id], entity_ids: vec![new_item.id],
tool tool
@ -1179,7 +1176,6 @@ where
entity_id: new_item.id, entity_id: new_item.id,
item: item_detail, item: item_detail,
}; };
//let create_item = builder::message::create_individual_item(area_client, item_id, &item_detail).map_err(|_err| ItemStateError::Dummy)?;
let create_item = CreateItem::Individual(area_client, item_id, item_detail.clone()); let create_item = CreateItem::Individual(area_client, item_id, item_detail.clone());
(InventoryItemDetail::Individual(item_detail), create_item) (InventoryItemDetail::Individual(item_detail), create_item)
}; };

2
items/src/tasks.rs

@ -371,6 +371,8 @@ where
Ok((transaction, result)) Ok((transaction, result))
}) })
} }
#[allow(clippy::type_complexity)]
pub fn trade_items<'a, EG> ( pub fn trade_items<'a, EG> (
item_state: &'a mut ItemState, item_state: &'a mut ItemState,
entity_gateway: &'a mut EG, entity_gateway: &'a mut EG,

2
room/Cargo.toml

@ -10,7 +10,7 @@ quests = { workspace = true }
location = { workspace = true } location = { workspace = true }
drops = { workspace = true } drops = { workspace = true }
rand= { workspace = true }
rand = { workspace = true }
async-std = { workspace = true } async-std = { workspace = true }
futures = { workspace = true } futures = { workspace = true }
anyhow = { workspace = true } anyhow = { workspace = true }

8
room/src/room.rs

@ -40,7 +40,7 @@ impl Rooms {
pub async fn add(&self, room_id: RoomId, room: RoomState) -> Result<(), anyhow::Error> { pub async fn add(&self, room_id: RoomId, room: RoomState) -> Result<(), anyhow::Error> {
*self.0 *self.0
.get(room_id.0) .get(room_id.0)
.ok_or_else(|| RoomError::Invalid(room_id.0 as u32))?
.ok_or(RoomError::Invalid(room_id.0 as u32))?
.write() .write()
.await = Some(room); .await = Some(room);
Ok(()) Ok(())
@ -73,7 +73,7 @@ impl Rooms {
{ {
let room = self.0 let room = self.0
.get(room_id.0) .get(room_id.0)
.ok_or_else(|| RoomError::Invalid(room_id.0 as u32))?
.ok_or(RoomError::Invalid(room_id.0 as u32))?
.read() .read()
.await; .await;
if let Some(room) = room.as_ref() { if let Some(room) = room.as_ref() {
@ -91,7 +91,7 @@ impl Rooms {
{ {
let mut room = self.0 let mut room = self.0
.get(room_id.0) .get(room_id.0)
.ok_or_else(|| RoomError::Invalid(room_id.0 as u32))?
.ok_or(RoomError::Invalid(room_id.0 as u32))?
.write() .write()
.await; .await;
@ -221,7 +221,7 @@ impl RoomState {
} }
} }
#[allow(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
pub fn new (room_id: RoomEntityId, pub fn new (room_id: RoomEntityId,
mode: RoomEntityMode, mode: RoomEntityMode,
episode: Episode, episode: Episode,

2
src/bin/main.rs

@ -8,7 +8,7 @@ use elseware::patch::patch::{PatchServerState, generate_patch_tree, load_config,
use elseware::ship::ship::ShipServerStateBuilder; use elseware::ship::ship::ShipServerStateBuilder;
use maps::Holiday; use maps::Holiday;
use entity::gateway::{EntityGateway, InMemoryGateway, PostgresGateway};
use entity::gateway::{EntityGateway, InMemoryGateway};
use entity::account::{NewUserAccountEntity, NewUserSettingsEntity}; use entity::account::{NewUserAccountEntity, NewUserSettingsEntity};
use entity::character::NewCharacterEntity; use entity::character::NewCharacterEntity;
use entity::item::{NewItemEntity, ItemDetail, InventoryItemEntity}; use entity::item::{NewItemEntity, ItemDetail, InventoryItemEntity};

12
src/ship/mod.rs

@ -1,16 +1,4 @@
#[allow(clippy::module_inception)] #[allow(clippy::module_inception)]
pub mod ship; pub mod ship;
//pub mod location;
//pub mod character;
//pub mod client;
//pub mod room;
//pub mod items;
//pub mod item_stats;
//pub mod map;
//pub mod monster;
//pub mod drops;
pub mod packet; pub mod packet;
//pub mod quests;
//pub mod shops;
//pub mod trade;
pub mod chatcommand; pub mod chatcommand;
Loading…
Cancel
Save