@@ -13,12 +13,11 @@ use crate::bit_set;
13
13
/// To that end we always convert integers to little-endian format before
14
14
/// hashing and the architecture dependent `isize` and `usize` types are
15
15
/// extended to 64 bits if needed.
16
- pub struct StableHasher < W > {
16
+ pub struct StableHasher {
17
17
state : SipHasher128 ,
18
- width : PhantomData < W > ,
19
18
}
20
19
21
- impl < W : StableHasherResult > :: std:: fmt:: Debug for StableHasher < W > {
20
+ impl :: std:: fmt:: Debug for StableHasher {
22
21
fn fmt ( & self , f : & mut :: std:: fmt:: Formatter < ' _ > ) -> :: std:: fmt:: Result {
23
22
write ! ( f, "{:?}" , self . state)
24
23
}
@@ -28,15 +27,14 @@ pub trait StableHasherResult: Sized {
28
27
fn finish ( hasher : StableHasher < Self > ) -> Self ;
29
28
}
30
29
31
- impl < W : StableHasherResult > StableHasher < W > {
30
+ impl StableHasher {
32
31
pub fn new ( ) -> Self {
33
32
StableHasher {
34
33
state : SipHasher128 :: new_with_keys ( 0 , 0 ) ,
35
- width : PhantomData ,
36
34
}
37
35
}
38
36
39
- pub fn finish ( self ) -> W {
37
+ pub fn finish < W : StableHasherResult > ( self ) -> W {
40
38
W :: finish ( self )
41
39
}
42
40
}
@@ -54,14 +52,14 @@ impl StableHasherResult for u64 {
54
52
}
55
53
}
56
54
57
- impl < W > StableHasher < W > {
55
+ impl StableHasher {
58
56
#[ inline]
59
57
pub fn finalize ( self ) -> ( u64 , u64 ) {
60
58
self . state . finish128 ( )
61
59
}
62
60
}
63
61
64
- impl < W > Hasher for StableHasher < W > {
62
+ impl Hasher for StableHasher {
65
63
fn finish ( & self ) -> u64 {
66
64
panic ! ( "use StableHasher::finalize instead" ) ;
67
65
}
@@ -165,9 +163,7 @@ impl<W> Hasher for StableHasher<W> {
165
163
/// `StableHasher` takes care of endianness and `isize`/`usize` platform
166
164
/// differences.
167
165
pub trait HashStable < CTX > {
168
- fn hash_stable < W : StableHasherResult > ( & self ,
169
- hcx : & mut CTX ,
170
- hasher : & mut StableHasher < W > ) ;
166
+ fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) ;
171
167
}
172
168
173
169
/// Implement this for types that can be turned into stable keys like, for
0 commit comments