From c73ab25c9dbe40284cfd38beaf31e2a20a9810de Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 22 Sep 2026 18:22:46 +0200 Subject: refactor(engine): fix portion of clippy lints --- engine/src/util.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engine/src/util.rs') 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 { /// Substitute for the currently experimental function /// [`Option::get_or_try_insert_with`]. - /// See https://github.com/rust-lang/rust/issues/143648 + /// See fn get_or_try_insert_with_fn( &mut self, func: impl Fn() -> Result, @@ -20,7 +20,7 @@ impl OptionExt for Option func: impl FnOnce() -> Result, ) -> Result<&mut T, Err> { - if let None = self { + if self.is_none() { *self = Some(func()?); } @@ -160,7 +160,7 @@ impl 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 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 BitArrayItemMut<'_, BITS_PER_ITEM> { const ITEM_MASK: u8 = !(u8::MAX << BITS_PER_ITEM); -- cgit v1.2.3-18-g5258