Skip to content

Commit 5748fbd

Browse files
authored
Allow derive_hash_xor_eq (#135)
1 parent 31afe4a commit 5748fbd

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

src/block/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
// TODO: Remove once MSRV supports undocumented_unsafe_blocks
2+
#![allow(unknown_lints)]
13
#![allow(clippy::undocumented_unsafe_blocks)]
24
#![allow(dead_code)]
35
// TODO: Remove once the transmutes are fixed
4-
#![allow(unknown_lints)]
56
#![allow(clippy::missing_transmute_annotations)]
7+
// TODO: Remove once MSRV supports derived_hash_with_manual_eq
8+
#![allow(renamed_and_removed_lints)]
9+
#![allow(clippy::derive_hash_xor_eq)]
10+
#![allow(clippy::derived_hash_with_manual_eq)]
611

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

src/lib.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
//!
1515
//! Currently only SSE2/AVX/AVX2 on x86/x86_64 and wasm32 SIMD are supported as this is what stable Rust supports.
1616
#![no_std]
17+
// TODO: Remove once MSRV supports undocumented_unsafe_blocks
18+
#![allow(unknown_lints)]
1719
#![deny(clippy::undocumented_unsafe_blocks)]
20+
// TODO our MSRV supports older versions of Cargo that do not know the following are unsafe:
21+
// - Vec::from_raw_parts
22+
// - get_unchecked_mut
23+
#![allow(unused_unsafe)]
1824

1925
extern crate alloc;
2026
use alloc::{vec, vec::Vec};
@@ -390,10 +396,12 @@ impl FixedBitSet {
390396
/// Note: Also available with index syntax: `bitset[bit]`.
391397
#[inline]
392398
pub fn contains(&self, bit: usize) -> bool {
393-
(bit < self.length)
399+
if bit < self.length {
394400
// SAFETY: The above check ensures that the block and bit are within bounds.
395-
.then(|| unsafe { self.contains_unchecked(bit) })
396-
.unwrap_or(false)
401+
unsafe { self.contains_unchecked(bit) }
402+
} else {
403+
false
404+
}
397405
}
398406

399407
/// Return **true** if the bit is enabled in the **FixedBitSet**,
@@ -750,7 +758,7 @@ impl FixedBitSet {
750758
///
751759
/// Iterator element is the index of the `1` bit, type `usize`.
752760
#[inline]
753-
pub fn ones(&self) -> Ones {
761+
pub fn ones(&self) -> Ones<'_> {
754762
match self.as_slice().split_first() {
755763
Some((&first_block, rem)) => {
756764
let (&last_block, rem) = rem.split_last().unwrap_or((&0, rem));
@@ -813,7 +821,7 @@ impl FixedBitSet {
813821
///
814822
/// Iterator element is the index of the `0` bit, type `usize`.
815823
#[inline]
816-
pub fn zeroes(&self) -> Zeroes {
824+
pub fn zeroes(&self) -> Zeroes<'_> {
817825
match self.as_slice().split_first() {
818826
Some((&block, rem)) => Zeroes {
819827
bitset: !block,
@@ -1618,7 +1626,7 @@ impl Iterator for IntoOnes {
16181626
// Ones will continue to return None once it first returns None.
16191627
impl FusedIterator for IntoOnes {}
16201628

1621-
impl<'a> BitAnd for &'a FixedBitSet {
1629+
impl BitAnd for &FixedBitSet {
16221630
type Output = FixedBitSet;
16231631
fn bitand(self, other: &FixedBitSet) -> FixedBitSet {
16241632
let (short, long) = {
@@ -1649,7 +1657,7 @@ impl BitAndAssign<&Self> for FixedBitSet {
16491657
}
16501658
}
16511659

1652-
impl<'a> BitOr for &'a FixedBitSet {
1660+
impl BitOr for &FixedBitSet {
16531661
type Output = FixedBitSet;
16541662
fn bitor(self, other: &FixedBitSet) -> FixedBitSet {
16551663
let (short, long) = {
@@ -1680,7 +1688,7 @@ impl BitOrAssign<&Self> for FixedBitSet {
16801688
}
16811689
}
16821690

1683-
impl<'a> BitXor for &'a FixedBitSet {
1691+
impl BitXor for &FixedBitSet {
16841692
type Output = FixedBitSet;
16851693
fn bitxor(self, other: &FixedBitSet) -> FixedBitSet {
16861694
let (short, long) = {

0 commit comments

Comments
 (0)