mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Clippy
This commit is contained in:
parent
8d9625d6ee
commit
73c84dfcc2
@ -349,21 +349,18 @@ impl StateExt for State {
|
|||||||
nearby_items.sort_by_key(|(_, dist_sqrd)| (dist_sqrd * 1000.0) as i32);
|
nearby_items.sort_by_key(|(_, dist_sqrd)| (dist_sqrd * 1000.0) as i32);
|
||||||
for (nearby, _) in nearby_items {
|
for (nearby, _) in nearby_items {
|
||||||
// Only merge if the loot owner is the same
|
// 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 loot_owners.get(nearby).map(|lo| lo.owner()) == loot_owner.map(|lo| lo.owner())
|
||||||
if items
|
&& items
|
||||||
.get(nearby)
|
.get(nearby)
|
||||||
.map_or(false, |nearby_item| nearby_item.can_merge(&item))
|
.map_or(false, |nearby_item| nearby_item.can_merge(&item))
|
||||||
{
|
{
|
||||||
// Merging can occur! Perform the merge:
|
// Merging can occur! Perform the merge:
|
||||||
items
|
items
|
||||||
.get_mut(nearby)
|
.get_mut(nearby)
|
||||||
.expect("we know that the item exists")
|
.expect("we know that the item exists")
|
||||||
.try_merge(item)
|
.try_merge(item)
|
||||||
.expect(
|
.expect("`try_merge` should succeed because `can_merge` returned `true`");
|
||||||
"`try_merge` should succeed because `can_merge` returned `true`",
|
return None;
|
||||||
);
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Only if merging items fails do we give up and create a new item
|
// Only if merging items fails do we give up and create a new item
|
||||||
|
Loading…
Reference in New Issue
Block a user