Skip to content

Commit

Permalink
Auto merge of #7945 - hbina:small_change_to_siphasher, r=alexcrichton
Browse files Browse the repository at this point in the history
Simplified usage code of SipHasher

SipHasher::new_with_keys(0,0) is just a longer version of just _::new()
i.e. the latter is an alias for the former.

Just a bit of a nothing burger I noticed while debugging some other issue.
  • Loading branch information
bors committed Feb 28, 2020
2 parents 6256eca + 142c057 commit 62180bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/context/compilation_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ fn compute_metadata<'a, 'cfg>(
return None;
}

let mut hasher = SipHasher::new_with_keys(0, 0);
let mut hasher = SipHasher::new();

// This is a generic version number that can be changed to make
// backwards-incompatible changes to any file structures in the output
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn to_hex(num: u64) -> String {
}

pub fn hash_u64<H: Hash>(hashable: H) -> u64 {
let mut hasher = SipHasher::new_with_keys(0, 0);
let mut hasher = SipHasher::new();
hashable.hash(&mut hasher);
hasher.finish()
}
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/util/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl Drop for Cache {
}

fn rustc_fingerprint(path: &Path, rustup_rustc: &Path) -> CargoResult<u64> {
let mut hasher = SipHasher::new_with_keys(0, 0);
let mut hasher = SipHasher::new();

let path = paths::resolve_executable(path)?;
path.hash(&mut hasher);
Expand Down Expand Up @@ -260,7 +260,7 @@ fn rustc_fingerprint(path: &Path, rustup_rustc: &Path) -> CargoResult<u64> {
}

fn process_fingerprint(cmd: &ProcessBuilder) -> u64 {
let mut hasher = SipHasher::new_with_keys(0, 0);
let mut hasher = SipHasher::new();
cmd.get_args().hash(&mut hasher);
let mut env = cmd.get_envs().iter().collect::<Vec<_>>();
env.sort_unstable();
Expand Down

0 comments on commit 62180bf

Please sign in to comment.