From 2959181873a9a042cbc12f12e46acaaef1782546 Mon Sep 17 00:00:00 2001 From: jake Date: Thu, 20 Oct 2022 18:38:04 -0600 Subject: [PATCH] cleanup --- src/ship/items/actions.rs | 3 +-- src/ship/items/state.rs | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ship/items/actions.rs b/src/ship/items/actions.rs index 8e57d79..466c4d3 100644 --- a/src/ship/items/actions.rs +++ b/src/ship/items/actions.rs @@ -56,7 +56,6 @@ where let character = character.clone(); move |(mut item_state, transaction), floor_item| { let character = character.clone(); - let transaction = transaction.clone(); Box::pin(async move { let mut inventory = item_state.inventory(&character.id).await?; @@ -538,7 +537,7 @@ where } } - +#[allow(clippy::needless_lifetimes)] // clippy this lifetime is not needless get off my case pub(super) fn add_bought_item_to_inventory<'a, EG, TR>( character_id: CharacterEntityId, shop_item: &'a (dyn ShopItem + Send + Sync), diff --git a/src/ship/items/state.rs b/src/ship/items/state.rs index 0796997..9cea40f 100644 --- a/src/ship/items/state.rs +++ b/src/ship/items/state.rs @@ -401,7 +401,7 @@ impl ItemStateProxy { if let Some(element) = master .read() .await - .get(&key) { + .get(key) { *element .write() .await = value.clone(); @@ -453,7 +453,7 @@ impl ItemStateProxy { pub async fn inventory(&mut self, character_id: &CharacterEntityId) -> Result { get_or_clone(&self.item_state.character_inventory, - &mut self.proxied_state.character_inventory, + &self.proxied_state.character_inventory, *character_id, ItemStateError::NoCharacter).await } @@ -464,7 +464,7 @@ impl ItemStateProxy { pub async fn bank(&mut self, character_id: &CharacterEntityId) -> Result { get_or_clone(&self.item_state.character_bank, - &mut self.proxied_state.character_bank, + &self.proxied_state.character_bank, *character_id, ItemStateError::NoCharacter).await } @@ -477,8 +477,8 @@ impl ItemStateProxy { let room_id = *self.item_state.character_room.read().await.get(character_id).unwrap(); Ok(FloorState { character_id: *character_id, - local: get_or_clone(&self.item_state.character_floor, &mut self.proxied_state.character_floor, *character_id, ItemStateError::NoCharacter).await?, - shared: get_or_clone(&self.item_state.room_floor, &mut self.proxied_state.room_floor, room_id, ItemStateError::NoRoom).await?, + local: get_or_clone(&self.item_state.character_floor, &self.proxied_state.character_floor, *character_id, ItemStateError::NoCharacter).await?, + shared: get_or_clone(&self.item_state.room_floor, &self.proxied_state.room_floor, room_id, ItemStateError::NoRoom).await?, }) }