From fc448cf3f4f0927078f74974bac75bca0e874946 Mon Sep 17 00:00:00 2001 From: ToMe25 Date: Fri, 7 Jun 2024 15:32:46 +0200 Subject: [PATCH 1/2] Optimize Set is_disjoint --- src/set.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 4b6e11d3a5753521b2f6543a25da1366ac8809b6 Mon Sep 17 00:00:00 2001 From: ToMe25 Date: Tue, 11 Jun 2024 14:46:42 +0200 Subject: [PATCH 2/2] restrict RawIterHash and RawIterHashInner to feature raw This will hopefully fix the CI error. --- src/raw/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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;