Skip to content

Commit

Permalink
Fix for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
pczarn committed Jun 29, 2024
1 parent b92c6e2 commit c7c1dce
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ fn blocks_for_bits<B: BitBlock>(bits: usize) -> usize {
}
}

#[allow(clippy::iter_skip_zero)]
// Take two BitVec's, and return iterators of their words, where the shorter one
// has been padded with 0's
fn match_words<'a, 'b, B: BitBlock>(
Expand Down Expand Up @@ -163,7 +164,7 @@ impl<B: BitBlock> Extend<usize> for BitSet<B> {
impl<B: BitBlock> PartialOrd for BitSet<B> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.iter().partial_cmp(other)
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -755,9 +756,7 @@ impl<B: BitBlock> BitSet<B> {
/// Returns the number of set bits in this set.
#[inline]
pub fn len(&self) -> usize {
self.bit_vec
.blocks()
.fold(0, |acc, n| acc + n.count_ones() as usize)
self.bit_vec.blocks().fold(0, |acc, n| acc + n.count_ones())
}

/// Returns whether there are no bits set in this set
Expand Down Expand Up @@ -890,7 +889,7 @@ pub struct Difference<'a, B: 'a>(BlockIter<TwoBitPositions<'a, B>, B>);
#[derive(Clone)]
pub struct SymmetricDifference<'a, B: 'a>(BlockIter<TwoBitPositions<'a, B>, B>);

impl<'a, T, B: BitBlock> Iterator for BlockIter<T, B>
impl<T, B: BitBlock> Iterator for BlockIter<T, B>
where
T: Iterator<Item = B>,
{
Expand All @@ -913,7 +912,7 @@ where
// update block, removing the LSB
self.head = self.head & (self.head - B::one());
// return offset + (index of LSB)
Some(self.head_offset + (B::count_ones(k) as usize))
Some(self.head_offset + (B::count_ones(k)))
}

#[inline]
Expand Down

0 comments on commit c7c1dce

Please # to comment.