Use hash_stable for hashing str

This commit is contained in:
Jakub Beránek 2021-12-20 18:46:34 +01:00
parent d3848cb659
commit c695b6026c
No known key found for this signature in database
GPG Key ID: DBC553E540C2F619

View File

@ -377,9 +377,8 @@ fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
impl<CTX> HashStable<CTX> for str {
#[inline]
fn hash_stable(&self, _: &mut CTX, hasher: &mut StableHasher) {
self.len().hash(hasher);
self.as_bytes().hash(hasher);
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
self.as_bytes().hash_stable(ctx, hasher);
}
}