Skip to content

Commit

Permalink
Rollup merge of rust-lang#71727 - hbina:simplified_usage, r=Mark-Simu…
Browse files Browse the repository at this point in the history
…lacrum

SipHasher with keys initialized to 0 should just use new()

I believe that is what the `new()` is for, for good reasons.
  • Loading branch information
Dylan-DPC authored May 5, 2020
2 parents 09cea4a + 19e5da9 commit f4e080f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/test/ui/deriving/deriving-hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct Person {
enum E { A=1, B }

fn hash<T: Hash>(t: &T) -> u64 {
let mut s = SipHasher::new_with_keys(0, 0);
let mut s = SipHasher::new();
t.hash(&mut s);
s.finish()
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-16530.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use std::hash::{SipHasher, Hasher, Hash};
struct Empty;

pub fn main() {
let mut s1 = SipHasher::new_with_keys(0, 0);
let mut s1 = SipHasher::new();
Empty.hash(&mut s1);
let mut s2 = SipHasher::new_with_keys(0, 0);
let mut s2 = SipHasher::new();
Empty.hash(&mut s2);
assert_eq!(s1.finish(), s2.finish());
}

0 comments on commit f4e080f

Please sign in to comment.