diff --git a/crates/oxc_span/src/hash.rs b/crates/oxc_span/src/hash.rs index fba0e635ffbae..0fa61dc23dcf8 100644 --- a/crates/oxc_span/src/hash.rs +++ b/crates/oxc_span/src/hash.rs @@ -10,16 +10,6 @@ use std::{ /// As an example, In AST types we ignore fields such as [crate::Span]. pub trait ContentHash { fn content_hash(&self, state: &mut H); - - /// The default implementation is usually sufficient. - fn content_hash_slice(data: &[Self], state: &mut H) - where - Self: Sized, - { - for piece in data { - piece.content_hash(state); - } - } } /// Short-Circuting implementation for [Discriminant] since it is used to hash enums. @@ -46,7 +36,17 @@ impl<'a, T: ContentHash> ContentHash for oxc_allocator::Box<'a, T> { impl<'a, T: ContentHash> ContentHash for oxc_allocator::Vec<'a, T> { fn content_hash(&self, state: &mut H) { - ContentHash::content_hash_slice(self.as_slice(), state); + for piece in self { + piece.content_hash(state); + } + } +} + +impl ContentHash for [T] { + fn content_hash(&self, state: &mut H) { + for piece in self { + piece.content_hash(state); + } } }