diff options
| author | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
| commit | 34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch) | |
| tree | 7920fec1203e8e96463a142f5f6da6164e76e684 /azalea-client/src/inventory.rs | |
| parent | bdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff) | |
| download | azalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz | |
update to rust edition 2024
Diffstat (limited to 'azalea-client/src/inventory.rs')
| -rw-r--r-- | azalea-client/src/inventory.rs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/azalea-client/src/inventory.rs b/azalea-client/src/inventory.rs index 2dd17853..4d796c9c 100644 --- a/azalea-client/src/inventory.rs +++ b/azalea-client/src/inventory.rs @@ -26,10 +26,10 @@ use bevy_ecs::{ use tracing::warn; use crate::{ + Client, local_player::PlayerAbilities, - packet_handling::game::{handle_send_packet_event, SendPacketEvent}, + packet_handling::game::{SendPacketEvent, handle_send_packet_event}, respawn::perform_respawn, - Client, }; pub struct InventoryPlugin; @@ -124,10 +124,9 @@ impl Inventory { /// /// Use [`Self::menu_mut`] if you need a mutable reference. pub fn menu(&self) -> &azalea_inventory::Menu { - if let Some(menu) = &self.container_menu { - menu - } else { - &self.inventory_menu + match &self.container_menu { + Some(menu) => menu, + _ => &self.inventory_menu, } } @@ -137,10 +136,9 @@ impl Inventory { /// /// Use [`Self::menu`] if you don't need a mutable reference. pub fn menu_mut(&mut self) -> &mut azalea_inventory::Menu { - if let Some(menu) = &mut self.container_menu { - menu - } else { - &mut self.inventory_menu + match &mut self.container_menu { + Some(menu) => menu, + _ => &mut self.inventory_menu, } } @@ -286,10 +284,9 @@ impl Inventory { carried_count -= new_carried.count - slot_item_count; // we have to inline self.menu_mut() here to avoid the borrow checker // complaining - let menu = if let Some(menu) = &mut self.container_menu { - menu - } else { - &mut self.inventory_menu + let menu = match &mut self.container_menu { + Some(menu) => menu, + _ => &mut self.inventory_menu, }; *menu.slot_mut(slot_index as usize).unwrap() = ItemStack::Present(new_carried); |
