@@ -18,22 +18,24 @@ 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:: BuildHasher as _;
37+ use std:: hash:: Hash ;
38+ use std:: hash:: Hasher as _;
3739use std:: io:: { BufRead , BufReader , BufWriter , Read , Write , stdin, stdout} ;
3840use std:: num:: { IntErrorKind , NonZero } ;
3941use std:: ops:: Range ;
@@ -1681,7 +1683,7 @@ fn index_legacy_warnings(processed_args: &[OsString], legacy_warnings: &mut [Leg
16811683 return ;
16821684 }
16831685
1684- let mut index_by_arg = std :: collections :: HashMap :: new ( ) ;
1686+ let mut index_by_arg = HashMap :: default ( ) ;
16851687 for ( warning_idx, warning) in legacy_warnings. iter ( ) . enumerate ( ) {
16861688 index_by_arg. insert ( warning. arg_index , warning_idx) ;
16871689 }
@@ -2909,7 +2911,7 @@ fn salt_from_random_source(path: &Path) -> UResult<[u8; SALT_LEN]> {
29092911 let mut reader = open_with_open_failed_error ( path) ?;
29102912 let mut buf = [ 0u8 ; BUF_LEN ] ;
29112913 let mut total = 0usize ;
2912- let mut hasher = FnvHasher :: default ( ) ;
2914+ let mut hasher = Hasher :: default ( ) ;
29132915
29142916 loop {
29152917 let n = reader
@@ -2934,7 +2936,7 @@ fn salt_from_random_source(path: &Path) -> UResult<[u8; SALT_LEN]> {
29342936 }
29352937
29362938 let first = hasher. finish ( ) ;
2937- let mut second_hasher = FnvHasher :: default ( ) ;
2939+ let mut second_hasher = Hasher :: default ( ) ;
29382940 second_hasher. write ( RANDOM_SOURCE_TAG ) ;
29392941 second_hasher. write_u64 ( first) ;
29402942 let second = second_hasher. finish ( ) ;
@@ -2946,7 +2948,8 @@ fn salt_from_random_source(path: &Path) -> UResult<[u8; SALT_LEN]> {
29462948}
29472949
29482950fn get_hash < T : Hash > ( t : & T ) -> u64 {
2949- let mut s = FnvHasher :: default ( ) ;
2951+ // Is reproducibility of get_hash itself needed for --random-source ?
2952+ let mut s = ahash:: RandomState :: with_seeds ( 0 , 0 , 0 , 0 ) . build_hasher ( ) ;
29502953 t. hash ( & mut s) ;
29512954 s. finish ( )
29522955}
@@ -3090,7 +3093,7 @@ mod tests {
30903093 fn test_get_hash ( ) {
30913094 let a = "Ted" . to_string ( ) ;
30923095
3093- assert_eq ! ( 2_646_829_031_758_483_623 , get_hash( & a) ) ;
3096+ assert_eq ! ( 6_449_979_114_061_965_534 , get_hash( & a) ) ;
30943097 }
30953098
30963099 #[ test]
0 commit comments