Skip to content

Commit a353e72

Browse files
committed
allow clippy::zero_sized_map_values
also move comment why using a hashmap in the first place
1 parent 5cc9dab commit a353e72

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/unique_impl.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Use a Hashmap for the Entry API in order to prevent hashing twice.
2+
// This can maybe be replaced with a HashSet once `get_or_insert_with`
3+
// or a proper Entry API for Hashset is stable and meets this msrv
4+
#![allow(clippy::zero_sized_map_values)]
5+
16
use std::collections::HashMap;
27
use std::collections::hash_map::Entry;
38
use std::hash::Hash;
@@ -11,9 +16,7 @@ use std::iter::FusedIterator;
1116
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
1217
pub struct UniqueBy<I: Iterator, V, F> {
1318
iter: I,
14-
// Use a Hashmap for the Entry API in order to prevent hashing twice.
15-
// This can maybe be replaced with a HashSet once `get_or_insert_with`
16-
// or a proper Entry API for Hashset is stable and meets this msrv
19+
// see comment for `allow(clippy::zero_sized_map_values)` for reasoning
1720
used: HashMap<V, ()>,
1821
f: F,
1922
}

0 commit comments

Comments
 (0)