aboutsummaryrefslogtreecommitdiff
path: root/azalea-inventory/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-02-22 23:01:54 +0000
committermat <git@matdoes.dev>2025-02-22 23:01:54 +0000
commit34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch)
tree7920fec1203e8e96463a142f5f6da6164e76e684 /azalea-inventory/src
parentbdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff)
downloadazalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz
update to rust edition 2024
Diffstat (limited to 'azalea-inventory/src')
-rw-r--r--azalea-inventory/src/components.rs7
-rw-r--r--azalea-inventory/src/operations.rs16
-rw-r--r--azalea-inventory/src/slot.rs21
3 files changed, 23 insertions, 21 deletions
diff --git a/azalea-inventory/src/components.rs b/azalea-inventory/src/components.rs
index 6dd60819..b299664f 100644
--- a/azalea-inventory/src/components.rs
+++ b/azalea-inventory/src/components.rs
@@ -42,10 +42,9 @@ where
}
fn eq(&self, other: Box<dyn EncodableDataComponent>) -> bool {
let other_any: Box<dyn Any> = other;
- if let Some(other) = other_any.downcast_ref::<T>() {
- self == other
- } else {
- false
+ match other_any.downcast_ref::<T>() {
+ Some(other) => self == other,
+ _ => false,
}
}
}
diff --git a/azalea-inventory/src/operations.rs b/azalea-inventory/src/operations.rs
index 0df7c794..90ad2403 100644
--- a/azalea-inventory/src/operations.rs
+++ b/azalea-inventory/src/operations.rs
@@ -3,14 +3,14 @@ use std::ops::RangeInclusive;
use azalea_buf::AzBuf;
use crate::{
- item::MaxStackSizeExt, AnvilMenuLocation, BeaconMenuLocation, BlastFurnaceMenuLocation,
- BrewingStandMenuLocation, CartographyTableMenuLocation, Crafter3x3MenuLocation,
- CraftingMenuLocation, EnchantmentMenuLocation, FurnaceMenuLocation, Generic3x3MenuLocation,
- Generic9x1MenuLocation, Generic9x2MenuLocation, Generic9x3MenuLocation, Generic9x4MenuLocation,
- Generic9x5MenuLocation, Generic9x6MenuLocation, GrindstoneMenuLocation, HopperMenuLocation,
- ItemStack, ItemStackData, LecternMenuLocation, LoomMenuLocation, Menu, MenuLocation,
- MerchantMenuLocation, Player, PlayerMenuLocation, ShulkerBoxMenuLocation, SmithingMenuLocation,
- SmokerMenuLocation, StonecutterMenuLocation,
+ AnvilMenuLocation, BeaconMenuLocation, BlastFurnaceMenuLocation, BrewingStandMenuLocation,
+ CartographyTableMenuLocation, Crafter3x3MenuLocation, CraftingMenuLocation,
+ EnchantmentMenuLocation, FurnaceMenuLocation, Generic3x3MenuLocation, Generic9x1MenuLocation,
+ Generic9x2MenuLocation, Generic9x3MenuLocation, Generic9x4MenuLocation, Generic9x5MenuLocation,
+ Generic9x6MenuLocation, GrindstoneMenuLocation, HopperMenuLocation, ItemStack, ItemStackData,
+ LecternMenuLocation, LoomMenuLocation, Menu, MenuLocation, MerchantMenuLocation, Player,
+ PlayerMenuLocation, ShulkerBoxMenuLocation, SmithingMenuLocation, SmokerMenuLocation,
+ StonecutterMenuLocation, item::MaxStackSizeExt,
};
#[derive(Debug, Clone)]
diff --git a/azalea-inventory/src/slot.rs b/azalea-inventory/src/slot.rs
index 3ca38f56..2b886955 100644
--- a/azalea-inventory/src/slot.rs
+++ b/azalea-inventory/src/slot.rs
@@ -310,21 +310,24 @@ impl PartialEq for DataComponentPatch {
return false;
}
for (kind, component) in &self.components {
- if let Some(other_component) = other.components.get(kind) {
- // we can't use PartialEq, but we can use our own eq method
- if let Some(component) = component {
- if let Some(other_component) = other_component {
- if !component.eq((*other_component).clone()) {
+ match other.components.get(kind) {
+ Some(other_component) => {
+ // we can't use PartialEq, but we can use our own eq method
+ if let Some(component) = component {
+ if let Some(other_component) = other_component {
+ if !component.eq((*other_component).clone()) {
+ return false;
+ }
+ } else {
return false;
}
- } else {
+ } else if other_component.is_some() {
return false;
}
- } else if other_component.is_some() {
+ }
+ _ => {
return false;
}
- } else {
- return false;
}
}
true