Skip to content

Commit

Permalink
Use BuildHasher::hash_one
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 28, 2023
1 parent 7ff6c9e commit b9bcbad
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ use std::collections::BTreeMap;
#[cfg(feature = "raw_value")]
use std::collections::HashMap;
use std::fmt::{self, Debug};
use std::hash::{BuildHasher, Hash, Hasher};
use std::hash::BuildHasher;
#[cfg(feature = "raw_value")]
use std::hash::{Hash, Hasher};
use std::io;
use std::iter;
use std::marker::PhantomData;
Expand Down Expand Up @@ -2490,11 +2492,7 @@ fn test_value_into_deserializer() {
#[test]
fn hash_positive_and_negative_zero() {
let rand = std::hash::RandomState::new();
let hash = |obj: Number| -> u64 {
let mut hasher = rand.build_hasher();
obj.hash(&mut hasher);
hasher.finish()
};
let hash = |obj| rand.hash_one(obj);

let k1 = serde_json::from_str::<Number>("0.0").unwrap();
let k2 = serde_json::from_str::<Number>("-0.0").unwrap();
Expand Down

0 comments on commit b9bcbad

Please sign in to comment.