@@ -18,22 +18,23 @@ mod merge;
1818mod numeric_str_cmp;
1919mod tmp_dir;
2020
21+ use ahash:: AHashMap as HashMap ;
22+ use ahash:: AHasher as Hasher ;
2123use bigdecimal:: BigDecimal ;
2224use chunks:: LineData ;
2325use clap:: builder:: ValueParser ;
2426use clap:: { Arg , ArgAction , ArgMatches , Command } ;
2527use custom_str_cmp:: custom_str_cmp;
26-
2728use ext_sort:: ext_sort;
28- use fnv:: FnvHasher ;
2929use numeric_str_cmp:: { NumInfo , NumInfoParseSettings , human_numeric_str_cmp, numeric_str_cmp} ;
3030use rand:: { Rng , rng} ;
3131use rayon:: prelude:: * ;
3232use std:: cmp:: Ordering ;
3333use std:: env;
3434use std:: ffi:: { OsStr , OsString } ;
3535use std:: fs:: { File , OpenOptions } ;
36- use std:: hash:: { Hash , Hasher } ;
36+ use std:: hash:: Hash ;
37+ use std:: hash:: Hasher as _;
3738use std:: io:: { BufRead , BufReader , BufWriter , Read , Write , stdin, stdout} ;
3839use std:: num:: { IntErrorKind , NonZero } ;
3940use std:: ops:: Range ;
@@ -1681,7 +1682,7 @@ fn index_legacy_warnings(processed_args: &[OsString], legacy_warnings: &mut [Leg
16811682 return ;
16821683 }
16831684
1684- let mut index_by_arg = std :: collections :: HashMap :: new ( ) ;
1685+ let mut index_by_arg = HashMap :: default ( ) ;
16851686 for ( warning_idx, warning) in legacy_warnings. iter ( ) . enumerate ( ) {
16861687 index_by_arg. insert ( warning. arg_index , warning_idx) ;
16871688 }
@@ -2909,7 +2910,7 @@ fn salt_from_random_source(path: &Path) -> UResult<[u8; SALT_LEN]> {
29092910 let mut reader = open_with_open_failed_error ( path) ?;
29102911 let mut buf = [ 0u8 ; BUF_LEN ] ;
29112912 let mut total = 0usize ;
2912- let mut hasher = FnvHasher :: default ( ) ;
2913+ let mut hasher = Hasher :: default ( ) ;
29132914
29142915 loop {
29152916 let n = reader
@@ -2934,7 +2935,7 @@ fn salt_from_random_source(path: &Path) -> UResult<[u8; SALT_LEN]> {
29342935 }
29352936
29362937 let first = hasher. finish ( ) ;
2937- let mut second_hasher = FnvHasher :: default ( ) ;
2938+ let mut second_hasher = Hasher :: default ( ) ;
29382939 second_hasher. write ( RANDOM_SOURCE_TAG ) ;
29392940 second_hasher. write_u64 ( first) ;
29402941 let second = second_hasher. finish ( ) ;
@@ -2946,9 +2947,8 @@ fn salt_from_random_source(path: &Path) -> UResult<[u8; SALT_LEN]> {
29462947}
29472948
29482949fn get_hash < T : Hash > ( t : & T ) -> u64 {
2949- let mut s = FnvHasher :: default ( ) ;
2950- t. hash ( & mut s) ;
2951- s. finish ( )
2950+ // Is reproducibility of get_hash itself needed for --random-source ?
2951+ ahash:: RandomState :: with_seeds ( 0 , 0 , 0 , 0 ) . hash_one ( t)
29522952}
29532953
29542954fn random_shuffle ( a : & [ u8 ] , b : & [ u8 ] , salt : & [ u8 ] ) -> Ordering {
@@ -3090,7 +3090,7 @@ mod tests {
30903090 fn test_get_hash ( ) {
30913091 let a = "Ted" . to_string ( ) ;
30923092
3093- assert_eq ! ( 2_646_829_031_758_483_623 , get_hash( & a) ) ;
3093+ assert_eq ! ( 6_449_979_114_061_965_534 , get_hash( & a) ) ;
30943094 }
30953095
30963096 #[ test]
0 commit comments