diff --git a/src/raw/mod.rs b/src/raw/mod.rs index c8e8e2912..210498351 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -4439,11 +4439,13 @@ impl FusedIterator for RawDrain<'_, T, A> {} /// created will be yielded by that iterator. /// - The order in which the iterator yields buckets is unspecified and may /// change in the future. +#[cfg(feature = "raw")] pub struct RawIterHash { inner: RawIterHashInner, _marker: PhantomData, } +#[cfg(feature = "raw")] struct RawIterHashInner { // See `RawTableInner`'s corresponding fields for details. // We can't store a `*const RawTableInner` as it would get @@ -4463,9 +4465,9 @@ struct RawIterHashInner { bitmask: BitMaskIter, } +#[cfg(feature = "raw")] impl RawIterHash { #[cfg_attr(feature = "inline-more", inline)] - #[cfg(feature = "raw")] unsafe fn new(table: &RawTable, hash: u64) -> Self { RawIterHash { inner: RawIterHashInner::new(&table.table, hash), @@ -4473,9 +4475,10 @@ impl RawIterHash { } } } + +#[cfg(feature = "raw")] impl RawIterHashInner { #[cfg_attr(feature = "inline-more", inline)] - #[cfg(feature = "raw")] unsafe fn new(table: &RawTableInner, hash: u64) -> Self { let h2_hash = h2(hash); let probe_seq = table.probe_seq(hash); @@ -4493,6 +4496,7 @@ impl RawIterHashInner { } } +#[cfg(feature = "raw")] impl Iterator for RawIterHash { type Item = Bucket; @@ -4512,6 +4516,7 @@ impl Iterator for RawIterHash { } } +#[cfg(feature = "raw")] impl Iterator for RawIterHashInner { type Item = usize; diff --git a/src/set.rs b/src/set.rs index bd98af7d0..7760bfd3b 100644 --- a/src/set.rs +++ b/src/set.rs @@ -1044,7 +1044,7 @@ where /// assert_eq!(a.is_disjoint(&b), false); /// ``` pub fn is_disjoint(&self, other: &Self) -> bool { - self.iter().all(|v| !other.contains(v)) + self.intersection(other).next().is_none() } /// Returns `true` if the set is a subset of another,