aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-10-15 16:53:34 -0500
committermat <github@matdoes.dev>2022-10-15 16:53:34 -0500
commit98224cf91337aa312b72de87ea4c1b22794619b2 (patch)
treea00f3468543d292c1b6f4eb212fcc3e3b3e13e2e /azalea-world/src
parenta348f67b9646cf51bedf413bf79271391bdb23b2 (diff)
downloadazalea-drasl-98224cf91337aa312b72de87ea4c1b22794619b2.tar.xz
fix clippy warnings
Diffstat (limited to 'azalea-world/src')
-rw-r--r--azalea-world/src/bit_storage.rs14
-rw-r--r--azalea-world/src/entity/data.rs2
-rw-r--r--azalea-world/src/palette.rs4
3 files changed, 10 insertions, 10 deletions
diff --git a/azalea-world/src/bit_storage.rs b/azalea-world/src/bit_storage.rs
index 2626c312..113f23bc 100644
--- a/azalea-world/src/bit_storage.rs
+++ b/azalea-world/src/bit_storage.rs
@@ -120,21 +120,21 @@ impl BitStorage {
let values_per_long = 64 / bits;
let magic_index = values_per_long - 1;
- let (divide_mul, divide_add, divide_shift) = MAGIC[magic_index as usize];
+ let (divide_mul, divide_add, divide_shift) = MAGIC[magic_index];
let calculated_length = (size + values_per_long - 1) / values_per_long;
let mask = (1 << bits) - 1;
let using_data = if let Some(data) = data {
- if data.len() != calculated_length as usize {
+ if data.len() != calculated_length {
return Err(BitStorageError::InvalidLength {
got: data.len(),
- expected: calculated_length as usize,
+ expected: calculated_length,
});
}
data
} else {
- vec![0; calculated_length as usize]
+ vec![0; calculated_length]
};
Ok(BitStorage {
@@ -179,7 +179,7 @@ impl BitStorage {
}
let cell_index = self.cell_index(index as u64);
- let cell = &self.data[cell_index as usize];
+ let cell = &self.data[cell_index];
let bit_index = (index - cell_index * self.values_per_long as usize) * self.bits;
cell >> bit_index & self.mask
}
@@ -193,7 +193,7 @@ impl BitStorage {
assert!(index < self.size);
assert!(value <= self.mask);
let cell_index = self.cell_index(index as u64);
- let cell = &mut self.data[cell_index as usize];
+ let cell = &mut self.data[cell_index];
let bit_index = (index - cell_index * self.values_per_long as usize) * self.bits;
let old_value = *cell >> (bit_index as u64) & self.mask;
*cell = *cell & !(self.mask << bit_index) | (value & self.mask) << bit_index;
@@ -209,7 +209,7 @@ impl BitStorage {
assert!(index < self.size);
assert!(value <= self.mask);
let cell_index = self.cell_index(index as u64);
- let cell = &mut self.data[cell_index as usize];
+ let cell = &mut self.data[cell_index];
let bit_index = (index - cell_index * self.values_per_long as usize) * self.bits;
*cell = *cell & !(self.mask << bit_index) | (value & self.mask) << bit_index;
}
diff --git a/azalea-world/src/entity/data.rs b/azalea-world/src/entity/data.rs
index 3fd07ecb..0f90c790 100644
--- a/azalea-world/src/entity/data.rs
+++ b/azalea-world/src/entity/data.rs
@@ -110,7 +110,7 @@ impl McBufReadable for EntityDataValue {
if val == 0 {
None
} else {
- Some((val - 1) as u32)
+ Some(val - 1)
}
}),
18 => EntityDataValue::Pose(Pose::read_from(buf)?),
diff --git a/azalea-world/src/palette.rs b/azalea-world/src/palette.rs
index a467ea93..ef445541 100644
--- a/azalea-world/src/palette.rs
+++ b/azalea-world/src/palette.rs
@@ -149,7 +149,7 @@ impl PalettedContainer {
}
Palette::Linear(palette) => {
if let Some(index) = palette.iter().position(|v| *v == value) {
- return index as usize;
+ return index;
}
let capacity = 2usize.pow(self.bits_per_entry.into());
if capacity > palette.len() {
@@ -162,7 +162,7 @@ impl PalettedContainer {
Palette::Hashmap(palette) => {
// TODO? vanilla keeps this in memory as a hashmap, but also i don't care
if let Some(index) = palette.iter().position(|v| *v == value) {
- return index as usize;
+ return index;
}
let capacity = 2usize.pow(self.bits_per_entry.into());
if capacity > palette.len() {