diff options
| author | HampusM <hampus@hampusmat.com> | 2026-09-22 18:22:46 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-09-22 18:22:46 +0200 |
| commit | c73ab25c9dbe40284cfd38beaf31e2a20a9810de (patch) | |
| tree | 51c5817a0c252a172c03a47e36886e563a4e623d /engine/src/util.rs | |
| parent | 2ccda0cd5f81909fddc74d95f960f781a64bcae1 (diff) | |
refactor(engine): fix portion of clippy lints
Diffstat (limited to 'engine/src/util.rs')
| -rw-r--r-- | engine/src/util.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/engine/src/util.rs b/engine/src/util.rs index f016ad3..61a8613 100644 --- a/engine/src/util.rs +++ b/engine/src/util.rs @@ -6,7 +6,7 @@ pub trait OptionExt<T> { /// Substitute for the currently experimental function /// [`Option::get_or_try_insert_with`]. - /// See https://github.com/rust-lang/rust/issues/143648 + /// See <https://github.com/rust-lang/rust/issues/143648> fn get_or_try_insert_with_fn<Err>( &mut self, func: impl Fn() -> Result<T, Err>, @@ -20,7 +20,7 @@ impl<T> OptionExt<T> for Option<T> func: impl FnOnce() -> Result<T, Err>, ) -> Result<&mut T, Err> { - if let None = self { + if self.is_none() { *self = Some(func()?); } @@ -160,7 +160,7 @@ impl<const BITS_PER_ITEM: usize> Iterator for BitArrayOccupiedIter<'_, BITS_PER_ self.mask &= (!Self::ITEM_MASK) << item_bit_index_in_byte; - let item_index_in_byte = item_bit_index_in_byte as usize / BITS_PER_ITEM; + let item_index_in_byte = item_bit_index_in_byte / BITS_PER_ITEM; let prev_bytes_item_cnt = (byte_index * 8) / BITS_PER_ITEM; @@ -220,7 +220,7 @@ impl<const BITS_PER_ITEM: usize> StreamingIterator self.mask &= (!Self::ITEM_MASK) << item_bit_index_in_byte; - let item_index_in_byte = item_bit_index_in_byte as usize / BITS_PER_ITEM; + let item_index_in_byte = item_bit_index_in_byte / BITS_PER_ITEM; let prev_bytes_item_cnt = (byte_index * 8) / BITS_PER_ITEM; @@ -243,7 +243,7 @@ pub struct BitArrayItemMut<'a, const BITS_PER_ITEM: usize> bit_index_in_byte: usize, } -impl<'a, const BITS_PER_ITEM: usize> BitArrayItemMut<'a, BITS_PER_ITEM> +impl<const BITS_PER_ITEM: usize> BitArrayItemMut<'_, BITS_PER_ITEM> { const ITEM_MASK: u8 = !(u8::MAX << BITS_PER_ITEM); |
