Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
james7132 committed Mar 20, 2024
1 parent 088928b commit 9ebed73
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
7 changes: 1 addition & 6 deletions src/block/avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
use core::{
cmp::Ordering,
hash::{Hash, Hasher},
iter::Iterator,
ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Not},
};
use core::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Not};

#[derive(Copy, Clone, Debug)]
#[repr(transparent)]
Expand Down
2 changes: 2 additions & 0 deletions src/block/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::undocumented_unsafe_blocks)]

use core::cmp::Ordering;
use core::hash::{Hash, Hasher};

Expand Down
21 changes: 9 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,13 +681,12 @@ impl FixedBitSet {
pub fn union_count(&self, other: &FixedBitSet) -> usize {
let me = self.as_slice();
let other = other.as_slice();
let mut count = Self::batch_count_ones(me.iter().zip(other.iter()).map(|(x, y)| (*x | *y)));
if other.len() > me.len() {
count += Self::batch_count_ones(other[me.len()..].iter().copied());
} else if self.len() > other.len() {
count += Self::batch_count_ones(me[other.len()..].iter().copied());
let count = Self::batch_count_ones(me.iter().zip(other.iter()).map(|(x, y)| (*x | *y)));
match other.len().cmp(&me.len()) {
Ordering::Greater => count + Self::batch_count_ones(other[me.len()..].iter().copied()),
Ordering::Less => count + Self::batch_count_ones(me[other.len()..].iter().copied()),
Ordering::Equal => count,
}
count
}

/// Computes how many bits would be set in the intersection between two bitsets.
Expand Down Expand Up @@ -730,12 +729,10 @@ impl FixedBitSet {
let me = self.as_slice();
let other = other.as_slice();
let count = Self::batch_count_ones(me.iter().zip(other.iter()).map(|(x, y)| (*x ^ *y)));
if other.len() > me.len() {
count + Self::batch_count_ones(other[me.len()..].iter().copied())
} else if me.len() > other.len() {
count + Self::batch_count_ones(me[other.len()..].iter().copied())
} else {
count
match other.len().cmp(&me.len()) {
Ordering::Greater => count + Self::batch_count_ones(other[me.len()..].iter().copied()),
Ordering::Less => count + Self::batch_count_ones(me[other.len()..].iter().copied()),
Ordering::Equal => count,
}
}

Expand Down

0 comments on commit 9ebed73

Please sign in to comment.