Skip to content

Commit 5e7bedc

Browse files
committed
Touch up PR 1127
1 parent 0af2bda commit 5e7bedc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/map.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use alloc::string::String;
1212
use alloc::vec::Vec;
1313
use core::borrow::Borrow;
1414
use core::fmt::{self, Debug};
15-
use core::hash::Hash;
15+
use core::hash::{Hash, Hasher};
1616
use core::iter::FusedIterator;
1717
#[cfg(feature = "preserve_order")]
1818
use core::mem;
@@ -373,15 +373,15 @@ impl Eq for Map<String, Value> {}
373373
#[cfg(not(feature = "preserve_order"))]
374374
impl Hash for Map<String, Value> {
375375
#[inline]
376-
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
376+
fn hash<H: Hasher>(&self, state: &mut H) {
377377
self.map.hash(state);
378378
}
379379
}
380+
380381
#[cfg(feature = "preserve_order")]
381382
impl Hash for Map<String, Value> {
382-
#[inline]
383-
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
384-
let mut kv = self.map.iter().collect::<Vec<_>>();
383+
fn hash<H: Hasher>(&self, state: &mut H) {
384+
let mut kv = Vec::from_iter(&self.map);
385385
kv.sort_unstable_by(|a, b| a.0.cmp(b.0));
386386
kv.hash(state);
387387
}

0 commit comments

Comments
 (0)