@@ -322,7 +322,7 @@ use std::sync::{Arc, Mutex};
322322use  std:: time:: SystemTime ; 
323323
324324use  anyhow:: { bail,  format_err,  Context  as  _} ; 
325- use  cargo_util:: { paths,  ProcessBuilder } ; 
325+ use  cargo_util:: { hash_u64 ,   paths,  to_hex ,   ProcessBuilder ,   StableHasher } ; 
326326use  filetime:: FileTime ; 
327327use  log:: { debug,  info} ; 
328328use  serde:: de; 
@@ -331,10 +331,9 @@ use serde::{Deserialize, Serialize};
331331
332332use  crate :: core:: compiler:: unit_graph:: UnitDep ; 
333333use  crate :: core:: Package ; 
334- use  crate :: util; 
335334use  crate :: util:: errors:: CargoResult ; 
336335use  crate :: util:: interning:: InternedString ; 
337- use  crate :: util:: { internal,  path_args,  profile,   StableHasher } ; 
336+ use  crate :: util:: { internal,  path_args,  profile} ; 
338337use  crate :: CARGO_ENV ; 
339338
340339use  super :: custom_build:: BuildDeps ; 
@@ -812,7 +811,7 @@ impl Fingerprint {
812811        if  let  Some ( s)  = * self . memoized_hash . lock ( ) . unwrap ( )  { 
813812            return  s; 
814813        } 
815-         let  ret = util :: hash_u64 ( self ) ; 
814+         let  ret = hash_u64 ( self ) ; 
816815        * self . memoized_hash . lock ( ) . unwrap ( )  = Some ( ret) ; 
817816        ret
818817    } 
@@ -1160,9 +1159,9 @@ impl DepFingerprint {
11601159        // `path` then we just hash the name, but otherwise we hash the full 
11611160        // id as it won't change when the directory is renamed. 
11621161        let  pkg_id = if  dep. unit . pkg . package_id ( ) . source_id ( ) . is_path ( )  { 
1163-             util :: hash_u64 ( dep. unit . pkg . package_id ( ) . name ( ) ) 
1162+             hash_u64 ( dep. unit . pkg . package_id ( ) . name ( ) ) 
11641163        }  else  { 
1165-             util :: hash_u64 ( dep. unit . pkg . package_id ( ) ) 
1164+             hash_u64 ( dep. unit . pkg . package_id ( ) ) 
11661165        } ; 
11671166
11681167        Ok ( DepFingerprint  { 
@@ -1309,15 +1308,15 @@ fn calculate_normal(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Finger
13091308    } 
13101309    . to_vec ( ) ; 
13111310
1312-     let  profile_hash = util :: hash_u64 ( ( 
1311+     let  profile_hash = hash_u64 ( ( 
13131312        & unit. profile , 
13141313        unit. mode , 
13151314        cx. bcx . extra_args_for ( unit) , 
13161315        cx. lto [ unit] , 
13171316    ) ) ; 
13181317    // Include metadata since it is exposed as environment variables. 
13191318    let  m = unit. pkg . manifest ( ) . metadata ( ) ; 
1320-     let  metadata = util :: hash_u64 ( ( & m. authors ,  & m. description ,  & m. homepage ,  & m. repository ) ) ; 
1319+     let  metadata = hash_u64 ( ( & m. authors ,  & m. description ,  & m. homepage ,  & m. repository ) ) ; 
13211320    let  mut  config = StableHasher :: new ( ) ; 
13221321    if  let  Some ( linker)  = cx. bcx . linker ( unit. kind )  { 
13231322        linker. hash ( & mut  config) ; 
@@ -1332,12 +1331,12 @@ fn calculate_normal(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Finger
13321331    } 
13331332    let  compile_kind = unit. kind . fingerprint_hash ( ) ; 
13341333    Ok ( Fingerprint  { 
1335-         rustc :  util :: hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) , 
1336-         target :  util :: hash_u64 ( & unit. target ) , 
1334+         rustc :  hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) , 
1335+         target :  hash_u64 ( & unit. target ) , 
13371336        profile :  profile_hash, 
13381337        // Note that .0 is hashed here, not .1 which is the cwd. That doesn't 
13391338        // actually affect the output artifact so there's no need to hash it. 
1340-         path :  util :: hash_u64 ( path_args ( cx. bcx . ws ,  unit) . 0 ) , 
1339+         path :  hash_u64 ( path_args ( cx. bcx . ws ,  unit) . 0 ) , 
13411340        features :  format ! ( "{:?}" ,  unit. features) , 
13421341        deps, 
13431342        local :  Mutex :: new ( local) , 
@@ -1402,7 +1401,7 @@ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-change
14021401
14031402    Ok ( Fingerprint  { 
14041403        local :  Mutex :: new ( local) , 
1405-         rustc :  util :: hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) , 
1404+         rustc :  hash_u64 ( & cx. bcx . rustc ( ) . verbose_version ) , 
14061405        deps, 
14071406        outputs :  if  overridden {  Vec :: new ( )  }  else  {  vec ! [ output]  } , 
14081407
@@ -1532,10 +1531,7 @@ fn build_script_override_fingerprint(
15321531    let  metadata = cx. get_run_build_script_metadata ( unit) ; 
15331532    // Returns None if it is not overridden. 
15341533    let  output = build_script_outputs. get ( metadata) ?; 
1535-     let  s = format ! ( 
1536-         "overridden build state with hash: {}" , 
1537-         util:: hash_u64( output) 
1538-     ) ; 
1534+     let  s = format ! ( "overridden build state with hash: {}" ,  hash_u64( output) ) ; 
15391535    Some ( LocalFingerprint :: Precalculated ( s) ) 
15401536} 
15411537
@@ -1586,7 +1582,7 @@ fn write_fingerprint(loc: &Path, fingerprint: &Fingerprint) -> CargoResult<()> {
15861582    // as we can use the full hash. 
15871583    let  hash = fingerprint. hash_u64 ( ) ; 
15881584    debug ! ( "write fingerprint ({:x}) : {}" ,  hash,  loc. display( ) ) ; 
1589-     paths:: write ( loc,  util :: to_hex ( hash) . as_bytes ( ) ) ?; 
1585+     paths:: write ( loc,  to_hex ( hash) . as_bytes ( ) ) ?; 
15901586
15911587    let  json = serde_json:: to_string ( fingerprint) . unwrap ( ) ; 
15921588    if  cfg ! ( debug_assertions)  { 
@@ -1637,7 +1633,7 @@ fn compare_old_fingerprint(
16371633
16381634    let  new_hash = new_fingerprint. hash_u64 ( ) ; 
16391635
1640-     if  util :: to_hex ( new_hash)  == old_fingerprint_short && new_fingerprint. fs_status . up_to_date ( )  { 
1636+     if  to_hex ( new_hash)  == old_fingerprint_short && new_fingerprint. fs_status . up_to_date ( )  { 
16411637        return  Ok ( ( ) ) ; 
16421638    } 
16431639
@@ -1646,10 +1642,7 @@ fn compare_old_fingerprint(
16461642        . with_context ( || internal ( "failed to deserialize json" ) ) ?; 
16471643    // Fingerprint can be empty after a failed rebuild (see comment in prepare_target). 
16481644    if  !old_fingerprint_short. is_empty ( )  { 
1649-         debug_assert_eq ! ( 
1650-             util:: to_hex( old_fingerprint. hash_u64( ) ) , 
1651-             old_fingerprint_short
1652-         ) ; 
1645+         debug_assert_eq ! ( to_hex( old_fingerprint. hash_u64( ) ) ,  old_fingerprint_short) ; 
16531646    } 
16541647    let  result = new_fingerprint. compare ( & old_fingerprint) ; 
16551648    assert ! ( result. is_err( ) ) ; 
0 commit comments