|
14 | 14 | //! |
15 | 15 | //! Currently only SSE2/AVX/AVX2 on x86/x86_64 and wasm32 SIMD are supported as this is what stable Rust supports. |
16 | 16 | #![no_std] |
| 17 | +// TODO: Remove once MSRV supports undocumented_unsafe_blocks |
| 18 | +#![allow(unknown_lints)] |
17 | 19 | #![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)] |
18 | 24 |
|
19 | 25 | extern crate alloc; |
20 | 26 | use alloc::{vec, vec::Vec}; |
@@ -390,10 +396,12 @@ impl FixedBitSet { |
390 | 396 | /// Note: Also available with index syntax: `bitset[bit]`. |
391 | 397 | #[inline] |
392 | 398 | pub fn contains(&self, bit: usize) -> bool { |
393 | | - (bit < self.length) |
| 399 | + if bit < self.length { |
394 | 400 | // 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 | + } |
397 | 405 | } |
398 | 406 |
|
399 | 407 | /// Return **true** if the bit is enabled in the **FixedBitSet**, |
@@ -750,7 +758,7 @@ impl FixedBitSet { |
750 | 758 | /// |
751 | 759 | /// Iterator element is the index of the `1` bit, type `usize`. |
752 | 760 | #[inline] |
753 | | - pub fn ones(&self) -> Ones { |
| 761 | + pub fn ones(&self) -> Ones<'_> { |
754 | 762 | match self.as_slice().split_first() { |
755 | 763 | Some((&first_block, rem)) => { |
756 | 764 | let (&last_block, rem) = rem.split_last().unwrap_or((&0, rem)); |
@@ -813,7 +821,7 @@ impl FixedBitSet { |
813 | 821 | /// |
814 | 822 | /// Iterator element is the index of the `0` bit, type `usize`. |
815 | 823 | #[inline] |
816 | | - pub fn zeroes(&self) -> Zeroes { |
| 824 | + pub fn zeroes(&self) -> Zeroes<'_> { |
817 | 825 | match self.as_slice().split_first() { |
818 | 826 | Some((&block, rem)) => Zeroes { |
819 | 827 | bitset: !block, |
@@ -1618,7 +1626,7 @@ impl Iterator for IntoOnes { |
1618 | 1626 | // Ones will continue to return None once it first returns None. |
1619 | 1627 | impl FusedIterator for IntoOnes {} |
1620 | 1628 |
|
1621 | | -impl<'a> BitAnd for &'a FixedBitSet { |
| 1629 | +impl BitAnd for &FixedBitSet { |
1622 | 1630 | type Output = FixedBitSet; |
1623 | 1631 | fn bitand(self, other: &FixedBitSet) -> FixedBitSet { |
1624 | 1632 | let (short, long) = { |
@@ -1649,7 +1657,7 @@ impl BitAndAssign<&Self> for FixedBitSet { |
1649 | 1657 | } |
1650 | 1658 | } |
1651 | 1659 |
|
1652 | | -impl<'a> BitOr for &'a FixedBitSet { |
| 1660 | +impl BitOr for &FixedBitSet { |
1653 | 1661 | type Output = FixedBitSet; |
1654 | 1662 | fn bitor(self, other: &FixedBitSet) -> FixedBitSet { |
1655 | 1663 | let (short, long) = { |
@@ -1680,7 +1688,7 @@ impl BitOrAssign<&Self> for FixedBitSet { |
1680 | 1688 | } |
1681 | 1689 | } |
1682 | 1690 |
|
1683 | | -impl<'a> BitXor for &'a FixedBitSet { |
| 1691 | +impl BitXor for &FixedBitSet { |
1684 | 1692 | type Output = FixedBitSet; |
1685 | 1693 | fn bitxor(self, other: &FixedBitSet) -> FixedBitSet { |
1686 | 1694 | let (short, long) = { |
|
0 commit comments