Skip to content

Commit

Permalink
Touch up PR 1127
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 25, 2024
1 parent 0af2bda commit 5e7bedc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use alloc::string::String;
use alloc::vec::Vec;
use core::borrow::Borrow;
use core::fmt::{self, Debug};
use core::hash::Hash;
use core::hash::{Hash, Hasher};
use core::iter::FusedIterator;
#[cfg(feature = "preserve_order")]
use core::mem;
Expand Down Expand Up @@ -373,15 +373,15 @@ impl Eq for Map<String, Value> {}
#[cfg(not(feature = "preserve_order"))]
impl Hash for Map<String, Value> {
#[inline]
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
fn hash<H: Hasher>(&self, state: &mut H) {
self.map.hash(state);
}
}

#[cfg(feature = "preserve_order")]
impl Hash for Map<String, Value> {
#[inline]
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
let mut kv = self.map.iter().collect::<Vec<_>>();
fn hash<H: Hasher>(&self, state: &mut H) {
let mut kv = Vec::from_iter(&self.map);
kv.sort_unstable_by(|a, b| a.0.cmp(b.0));
kv.hash(state);
}
Expand Down

0 comments on commit 5e7bedc

Please sign in to comment.