mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-22 20:03:37 +00:00
Use SmallVec in Hash map stable hashing
This commit is contained in:
parent
91b931926f
commit
e4b4d18f58
@ -552,7 +552,8 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>(
|
||||
SK: HashStable<HCX> + Ord,
|
||||
F: Fn(&K, &HCX) -> SK,
|
||||
{
|
||||
let mut entries: Vec<_> = map.iter().map(|(k, v)| (to_stable_hash_key(k, hcx), v)).collect();
|
||||
let mut entries: SmallVec<[_; 3]> =
|
||||
map.iter().map(|(k, v)| (to_stable_hash_key(k, hcx), v)).collect();
|
||||
entries.sort_unstable_by(|&(ref sk1, _), &(ref sk2, _)| sk1.cmp(sk2));
|
||||
entries.hash_stable(hcx, hasher);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user