From aa0256da102103eedc9897458dd81516962a80a3 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 7 May 2025 11:27:58 +0800 Subject: upgrade rust version and fix clippy warnings --- azalea/src/pathfinder/world.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'azalea/src/pathfinder/world.rs') diff --git a/azalea/src/pathfinder/world.rs b/azalea/src/pathfinder/world.rs index 3b1b36b9..940a7c84 100644 --- a/azalea/src/pathfinder/world.rs +++ b/azalea/src/pathfinder/world.rs @@ -47,10 +47,10 @@ impl CachedSections { if let Some(last_item) = self.sections.get(self.last_index) { if last_item.pos == pos { return Some(&mut self.sections[self.last_index]); - } else if let Some(second_last_item) = self.sections.get(self.second_last_index) { - if second_last_item.pos == pos { - return Some(&mut self.sections[self.second_last_index]); - } + } else if let Some(second_last_item) = self.sections.get(self.second_last_index) + && second_last_item.pos == pos + { + return Some(&mut self.sections[self.second_last_index]); } } @@ -134,17 +134,17 @@ impl CachedWorld { // optimization: avoid doing the iter lookup if the last chunk we looked up is // the same - if let Some(last_chunk_cache_index) = *self.last_chunk_cache_index.borrow() { - if cached_chunks[last_chunk_cache_index].0 == chunk_pos { - // don't bother with the iter lookup - let sections = &cached_chunks[last_chunk_cache_index].1; - if section_index >= sections.len() { - // y position is out of bounds - return None; - }; - let section: &azalea_world::palette::PalettedContainer = §ions[section_index]; - return Some(f(section)); - } + if let Some(last_chunk_cache_index) = *self.last_chunk_cache_index.borrow() + && cached_chunks[last_chunk_cache_index].0 == chunk_pos + { + // don't bother with the iter lookup + let sections = &cached_chunks[last_chunk_cache_index].1; + if section_index >= sections.len() { + // y position is out of bounds + return None; + }; + let section: &azalea_world::palette::PalettedContainer = §ions[section_index]; + return Some(f(section)); } // get section from cache -- cgit v1.2.3