From 34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 22 Feb 2025 23:01:54 +0000 Subject: update to rust edition 2024 --- azalea-entity/src/plugin/indexing.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'azalea-entity/src/plugin/indexing.rs') diff --git a/azalea-entity/src/plugin/indexing.rs b/azalea-entity/src/plugin/indexing.rs index 78d5fb7e..21dd273a 100644 --- a/azalea-entity/src/plugin/indexing.rs +++ b/azalea-entity/src/plugin/indexing.rs @@ -181,19 +181,24 @@ pub fn remove_despawned_entities_from_indexes( // remove the entity from the chunk index let chunk = ChunkPos::from(*position); - if let Some(entities_in_chunk) = instance.entities_by_chunk.get_mut(&chunk) { - if entities_in_chunk.remove(&entity) { - // remove the chunk if there's no entities in it anymore - if entities_in_chunk.is_empty() { - instance.entities_by_chunk.remove(&chunk); + match instance.entities_by_chunk.get_mut(&chunk) { + Some(entities_in_chunk) => { + if entities_in_chunk.remove(&entity) { + // remove the chunk if there's no entities in it anymore + if entities_in_chunk.is_empty() { + instance.entities_by_chunk.remove(&chunk); + } + } else { + warn!( + "Tried to remove entity {entity:?} from chunk {chunk:?} but the entity was not there." + ); } - } else { - warn!( - "Tried to remove entity {entity:?} from chunk {chunk:?} but the entity was not there." + } + _ => { + debug!( + "Tried to remove entity {entity:?} from chunk {chunk:?} but the chunk was not found." ); } - } else { - debug!("Tried to remove entity {entity:?} from chunk {chunk:?} but the chunk was not found."); } // remove it from the uuid index if entity_uuid_index.entity_by_uuid.remove(uuid).is_none() { -- cgit v1.2.3