Browse Source

clippy cleanup

pull/141/head
jake 1 year ago
parent
commit
9cff5ad088
  1. 6
      client/src/client.rs
  2. 6
      items/src/actions.rs
  3. 2
      items/src/tasks.rs
  4. 8
      room/src/room.rs
  5. 2
      src/bin/main.rs
  6. 12
      src/ship/mod.rs

6
client/src/client.rs

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

6
items/src/actions.rs

@ -8,7 +8,6 @@ use std::pin::Pin;
use std::iter::IntoIterator;
use anyhow::Context;
use libpso::packet::{ship::Message, messages::GameMessage};
use entity::character::{CharacterEntity, CharacterEntityId};
use entity::gateway::{EntityGateway, EntityGatewayTransaction};
use entity::item::{ItemDetail, NewItemEntity, TradeId, ItemModifier};
@ -22,7 +21,6 @@ use crate::floor::{FloorItem, FloorItemDetail};
use crate::apply_item::{apply_item, ApplyItemAction};
use shops::ShopItem;
use drops::{ItemDrop, ItemDropType};
//use crate::ship::packet::builder;
use location::AreaClient;
use maps::monster::MonsterType;
@ -1166,8 +1164,7 @@ where
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 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 {
entity_ids: vec![new_item.id],
tool
@ -1179,7 +1176,6 @@ where
entity_id: new_item.id,
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());
(InventoryItemDetail::Individual(item_detail), create_item)
};

2
items/src/tasks.rs

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

8
room/src/room.rs

@ -40,7 +40,7 @@ impl Rooms {
pub async fn add(&self, room_id: RoomId, room: RoomState) -> Result<(), anyhow::Error> {
*self.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()
.await = Some(room);
Ok(())
@ -73,7 +73,7 @@ impl Rooms {
{
let room = self.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()
.await;
if let Some(room) = room.as_ref() {
@ -91,7 +91,7 @@ impl Rooms {
{
let mut room = self.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()
.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,
mode: RoomEntityMode,
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 maps::Holiday;
use entity::gateway::{EntityGateway, InMemoryGateway, PostgresGateway};
use entity::gateway::{EntityGateway, InMemoryGateway};
use entity::account::{NewUserAccountEntity, NewUserSettingsEntity};
use entity::character::NewCharacterEntity;
use entity::item::{NewItemEntity, ItemDetail, InventoryItemEntity};

12
src/ship/mod.rs

@ -1,16 +1,4 @@
#[allow(clippy::module_inception)]
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 quests;
//pub mod shops;
//pub mod trade;
pub mod chatcommand;
Loading…
Cancel
Save