From 94a6ac63cfeb4bc578f793fd32448016364d8b45 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:18:01 +0000 Subject: [PATCH] refactor(span): use `Hasher` from `std` (#5476) Use `std::hash::Hasher` instead of `core::hash::Hasher`. I don't actually know if importing `core` as well as `std` has any compile time perf impact, but as we're using `std` anyway, we may as well use it for everything. Import into the `auto_impl_content_hash` module to make the macro a little easier to read. --- crates/oxc_span/src/hash.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_span/src/hash.rs b/crates/oxc_span/src/hash.rs index eee15b72d..fba0e635f 100644 --- a/crates/oxc_span/src/hash.rs +++ b/crates/oxc_span/src/hash.rs @@ -1,6 +1,5 @@ -use core::hash::Hasher; use std::{ - hash::Hash, + hash::{Hash, Hasher}, mem::{discriminant, Discriminant}, }; @@ -53,11 +52,12 @@ impl<'a, T: ContentHash> ContentHash for oxc_allocator::Vec<'a, T> { mod auto_impl_content_hash { use super::ContentHash; + macro_rules! impl_content_hash { ($($t:ty)*) => { $( impl ContentHash for $t { - fn content_hash(&self, state: &mut H) { + fn content_hash(&self, state: &mut H) { std::hash::Hash::hash(self, state); } }