From 73c84dfcc254aeb527ef784a3d5926cb8c4dca08 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Fri, 5 May 2023 00:04:13 +0100 Subject: [PATCH] Clippy --- server/src/state_ext.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/server/src/state_ext.rs b/server/src/state_ext.rs index 272b193fe3..0ea3374acf 100644 --- a/server/src/state_ext.rs +++ b/server/src/state_ext.rs @@ -349,21 +349,18 @@ impl StateExt for State { nearby_items.sort_by_key(|(_, dist_sqrd)| (dist_sqrd * 1000.0) as i32); for (nearby, _) in nearby_items { // Only merge if the loot owner is the same - if loot_owners.get(nearby).map(|lo| lo.owner()) == loot_owner.map(|lo| lo.owner()) { - if items + if loot_owners.get(nearby).map(|lo| lo.owner()) == loot_owner.map(|lo| lo.owner()) + && items .get(nearby) .map_or(false, |nearby_item| nearby_item.can_merge(&item)) - { - // Merging can occur! Perform the merge: - items - .get_mut(nearby) - .expect("we know that the item exists") - .try_merge(item) - .expect( - "`try_merge` should succeed because `can_merge` returned `true`", - ); - return None; - } + { + // Merging can occur! Perform the merge: + items + .get_mut(nearby) + .expect("we know that the item exists") + .try_merge(item) + .expect("`try_merge` should succeed because `can_merge` returned `true`"); + return None; } } // Only if merging items fails do we give up and create a new item