diff --git a/src/entity/gateway/postgres/models.rs b/src/entity/gateway/postgres/models.rs index b79ddaf..b017b3b 100644 --- a/src/entity/gateway/postgres/models.rs +++ b/src/entity/gateway/postgres/models.rs @@ -650,13 +650,13 @@ impl From for PgItemNoteDetail { ItemNote::Withdraw{character_id, bank} => { PgItemNoteDetail::Withdraw { character_id: character_id.0, - bank: bank, + bank, } }, ItemNote::Deposit{character_id, bank} => { PgItemNoteDetail::Deposit { character_id: character_id.0, - bank: bank, + bank, } } } @@ -697,11 +697,11 @@ impl From for ItemNote { }, PgItemNoteDetail::Withdraw{character_id, bank} => ItemNote::Withdraw { character_id: CharacterEntityId(character_id), - bank: bank, + bank, }, PgItemNoteDetail::Deposit{character_id, bank} => ItemNote::Deposit { character_id: CharacterEntityId(character_id), - bank: bank, + bank, }, } } diff --git a/src/entity/gateway/postgres/postgres.rs b/src/entity/gateway/postgres/postgres.rs index 9cb8a98..4de7413 100644 --- a/src/entity/gateway/postgres/postgres.rs +++ b/src/entity/gateway/postgres/postgres.rs @@ -635,7 +635,7 @@ async fn get_bank_meseta(conn: &mut sqlx::PgConnection, char_id: &CharacterEntit .bind(&bank_name.0) .fetch_optional(conn) .await? - .unwrap_or_else(|| PgMeseta(0)) + .unwrap_or(PgMeseta(0)) } }; Ok(Meseta(meseta.0 as u32)) diff --git a/src/login/character.rs b/src/login/character.rs index d88f6d2..60446fc 100644 --- a/src/login/character.rs +++ b/src/login/character.rs @@ -23,7 +23,7 @@ use libpso::{utf8_to_array, utf8_to_utf16_array}; use crate::entity::gateway::{EntityGateway, GatewayError}; use crate::entity::account::{UserAccountId, UserAccountEntity, NewUserSettingsEntity, USERFLAG_NEWCHAR, USERFLAG_DRESSINGROOM}; -use crate::entity::item::{NewItemEntity, ItemDetail, ItemNote, InventoryItemEntity, InventoryEntity, BankEntity, BankName, BankIdentifier, EquippedEntity, Meseta}; +use crate::entity::item::{NewItemEntity, ItemDetail, ItemNote, InventoryItemEntity, InventoryEntity, BankEntity, BankIdentifier, EquippedEntity, Meseta}; use crate::entity::item::weapon::Weapon; use crate::entity::item::armor::Armor; use crate::entity::item::tech::Technique; diff --git a/src/ship/chatcommand.rs b/src/ship/chatcommand.rs index 802199d..97d5054 100644 --- a/src/ship/chatcommand.rs +++ b/src/ship/chatcommand.rs @@ -7,15 +7,13 @@ use crate::ship::items::state::ItemState; use crate::entity::item::{BankName, BankIdentifier}; use crate::ship::packet::builder::message::bank_item_list; -async fn default_bank<'a, EG, T>(id: ClientId, - tokens: T, - entity_gateway: &mut EG, - clients: &Clients, - item_state: &mut ItemState) - -> Result, String> +async fn default_bank<'a, EG>(id: ClientId, + entity_gateway: &mut EG, + clients: &Clients, + item_state: &mut ItemState) + -> Result, String> where EG: EntityGateway + Clone + 'static, - T: Iterator + 'a, { let bank = clients .with_mut(id, |client| { @@ -28,8 +26,8 @@ where }) }) .await - .map_err(|err| format!("an error occured\n{:?}", err))? - .map_err(|err| format!("an error occured\n{:?}", err))?; + .map_err(|err| format!("an error occured\n{err:?}"))? + .map_err(|err| format!("an error occured\n{err:?}"))?; let bank_items_pkt = bank_item_list(&bank); Ok(vec![(id, SendShipPacket::BankItemList(bank_items_pkt))]) @@ -45,8 +43,7 @@ where EG: EntityGateway + Clone + 'static, T: Iterator + 'a, { - let bank_name = BankName(tokens.next().unwrap_or(&"").into()); - + let bank_name = BankName(tokens.next().unwrap_or("").into()); let bank = clients .with_mut(id, |client| { let mut item_state = item_state.clone(); @@ -58,8 +55,8 @@ where }) }) .await - .map_err(|err| format!("an error occured\n{:?}", err))? - .map_err(|err| format!("an error occured\n{:?}", err))?; + .map_err(|err| format!("an error occured\n{err:?}"))? + .map_err(|err| format!("an error occured\n{err:?}"))?; let bank_items_pkt = bank_item_list(&bank); Ok(vec![(id, SendShipPacket::BankItemList(bank_items_pkt))]) @@ -76,11 +73,11 @@ where let mut tokens = message.message .trim_start_matches("\tJ") .trim_start_matches("\tE") - .trim_end_matches("\0") + .trim_end_matches('\0') .split_whitespace(); let cmd = tokens.next()?; match cmd { - "/bank" => Some(default_bank(id, tokens, &mut state.entity_gateway, &state.clients, &mut state.item_state).await), + "/bank" => Some(default_bank(id, &mut state.entity_gateway, &state.clients, &mut state.item_state).await), "/sbank" => Some(switch_bank(id, tokens, &mut state.entity_gateway, &state.clients, &mut state.item_state).await), _ => None, diff --git a/src/ship/items/actions.rs b/src/ship/items/actions.rs index c807144..3b74a0a 100644 --- a/src/ship/items/actions.rs +++ b/src/ship/items/actions.rs @@ -424,7 +424,6 @@ where transaction.gateway().set_character_bank(&character_id, &bank.as_bank_entity(), &bank.identifier).await?; item_state.set_bank(bank).await; - Ok(((item_state, transaction), ())) }) } diff --git a/src/ship/items/bank.rs b/src/ship/items/bank.rs index 1513166..73f0e10 100644 --- a/src/ship/items/bank.rs +++ b/src/ship/items/bank.rs @@ -1,7 +1,7 @@ use std::cmp::Ordering; use libpso::character::character; use crate::ship::items::ClientItemId; -use crate::entity::item::{Meseta, ItemEntityId, ItemDetail, ItemEntity, BankEntity, BankItemEntity, BankName}; +use crate::entity::item::{Meseta, ItemEntityId, ItemDetail, ItemEntity, BankEntity, BankItemEntity}; use std::future::Future; use async_std::sync::{Arc, Mutex}; diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 0687173..8a1c6fa 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -736,7 +736,7 @@ impl ServerState for ShipServerState { self.direct_message(id, msg).await? }, RecvShipPacket::PlayerChat(msg) => { - match chatcommand::handle_chat_command(id, msg.clone(), &mut self).await { + match chatcommand::handle_chat_command(id, msg.clone(), self).await { Some(ccmd) => { match ccmd { Ok(pkts) => pkts,