]> git.proxmox.com Git - cargo.git/commitdiff
Simplified usage code of SipHasher
authorHanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Thu, 27 Feb 2020 19:16:05 +0000 (14:16 -0500)
committerHanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Thu, 27 Feb 2020 19:16:05 +0000 (14:16 -0500)
SipHasher::new_with_keys(0,0) is just a longer version of just _::new()
i.e. the latter is an alias for the former.

src/cargo/core/compiler/context/compilation_files.rs
src/cargo/util/hex.rs
src/cargo/util/rustc.rs

index f9eab92f67d18f80e11547e792db728df0a3f956..a9d6eb2861d03b915d76b848b7025955ffbc4aac 100644 (file)
@@ -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
index f3e905c9abae8c643c413d6117ac538540773656..4be23ba020c18a8f67a1ae8416fc03b54495e52d 100644 (file)
@@ -16,7 +16,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()
 }
index bb54119b91e32b258f1a6ba752e2e960287b7fc4..0a3e6e46276d988a5387b64b280c9b9bbc47eca6 100644 (file)
@@ -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);
@@ -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();