Skip to content

Commit 33adaf6

Browse files
authored
Merge pull request #732 from clarfonthey/default-less
Reduce reliance on default hasher/allocator
2 parents 81f99db + fbfed14 commit 33adaf6

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/map.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,7 +2608,12 @@ where
26082608
}
26092609
}
26102610

2611-
impl<K, V, F> FusedIterator for ExtractIf<'_, K, V, F> where F: FnMut(&K, &mut V) -> bool {}
2611+
impl<K, V, F, A> FusedIterator for ExtractIf<'_, K, V, F, A>
2612+
where
2613+
F: FnMut(&K, &mut V) -> bool,
2614+
A: Allocator,
2615+
{
2616+
}
26122617

26132618
/// A mutable iterator over the values of a `HashMap` in arbitrary order.
26142619
/// The iterator element type is `&'a mut V`.
@@ -5026,10 +5031,14 @@ where
50265031

50275032
#[expect(dead_code)]
50285033
fn assert_covariance() {
5029-
fn map_key<'new>(v: HashMap<&'static str, u8>) -> HashMap<&'new str, u8> {
5034+
fn map_key<'new, S: BuildHasher, A: Allocator>(
5035+
v: HashMap<&'static str, u8, S, A>,
5036+
) -> HashMap<&'new str, u8, S, A> {
50305037
v
50315038
}
5032-
fn map_val<'new>(v: HashMap<u8, &'static str>) -> HashMap<u8, &'new str> {
5039+
fn map_val<'new, S: BuildHasher, A: Allocator>(
5040+
v: HashMap<u8, &'static str, S, A>,
5041+
) -> HashMap<u8, &'new str, S, A> {
50335042
v
50345043
}
50355044
fn iter_key<'a, 'new>(v: Iter<'a, &'static str, u8>) -> Iter<'a, &'new str, u8> {
@@ -5060,9 +5069,9 @@ fn assert_covariance() {
50605069
fn values_val<'a, 'new>(v: Values<'a, u8, &'static str>) -> Values<'a, u8, &'new str> {
50615070
v
50625071
}
5063-
fn drain<'new>(
5064-
d: Drain<'static, &'static str, &'static str>,
5065-
) -> Drain<'new, &'new str, &'new str> {
5072+
fn drain<'new, A: Allocator>(
5073+
d: Drain<'static, &'static str, &'static str, A>,
5074+
) -> Drain<'new, &'new str, &'new str, A> {
50665075
d
50675076
}
50685077
}

src/set.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,9 @@ impl<'a, T, S, A: Allocator> VacantEntry<'a, T, S, A> {
25072507

25082508
#[expect(dead_code)]
25092509
fn assert_covariance() {
2510-
fn set<'new>(v: HashSet<&'static str>) -> HashSet<&'new str> {
2510+
fn set<'new, S: BuildHasher, A: Allocator>(
2511+
v: HashSet<&'static str, S, A>,
2512+
) -> HashSet<&'new str, S, A> {
25112513
v
25122514
}
25132515
fn iter<'a, 'new>(v: Iter<'a, &'static str>) -> Iter<'a, &'new str> {

0 commit comments

Comments
 (0)