diff options
| author | mat <git@matdoes.dev> | 2025-05-07 11:27:58 +0800 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-05-07 11:27:58 +0800 |
| commit | aa0256da102103eedc9897458dd81516962a80a3 (patch) | |
| tree | 9d01f879a7c75750acd8de0c308247c12bbeea9d /azalea/src/pathfinder/world.rs | |
| parent | e9452032bfc95cb7ad4a8798b13648e164536cf1 (diff) | |
| download | azalea-drasl-aa0256da102103eedc9897458dd81516962a80a3.tar.xz | |
upgrade rust version and fix clippy warnings
Diffstat (limited to 'azalea/src/pathfinder/world.rs')
| -rw-r--r-- | azalea/src/pathfinder/world.rs | 30 |
1 files changed, 15 insertions, 15 deletions
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 |
