aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder/world.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-05-07 11:27:58 +0800
committermat <git@matdoes.dev>2025-05-07 11:27:58 +0800
commitaa0256da102103eedc9897458dd81516962a80a3 (patch)
tree9d01f879a7c75750acd8de0c308247c12bbeea9d /azalea/src/pathfinder/world.rs
parente9452032bfc95cb7ad4a8798b13648e164536cf1 (diff)
downloadazalea-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.rs30
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 = &sections[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 = &sections[section_index];
+ return Some(f(section));
}
// get section from cache