From 66a4d370314d45b5d4a0117401002ac43dbcba0a Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 15 Nov 2023 17:43:22 -0500 Subject: [PATCH] build(common): Remove dependency on `string-cache` (#8291) --- Cargo.lock | 1 - crates/swc_bundler/src/bundler/load.rs | 2 +- crates/swc_common/Cargo.toml | 1 - crates/swc_common/src/eq.rs | 17 +---------------- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84fe15c34339..93dfa50ae62d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3891,7 +3891,6 @@ dependencies = [ "serde_json", "siphasher", "sourcemap", - "string_cache", "swc_atoms", "swc_eq_ignore_macros", "swc_visit", diff --git a/crates/swc_bundler/src/bundler/load.rs b/crates/swc_bundler/src/bundler/load.rs index 74cb31e593a6..aac26ff53193 100644 --- a/crates/swc_bundler/src/bundler/load.rs +++ b/crates/swc_bundler/src/bundler/load.rs @@ -411,7 +411,7 @@ pub(crate) struct Source { pub local_ctxt: SyntaxContext, pub export_ctxt: SyntaxContext, - // Clone is relatively cheap, thanks to string_cache. + // Clone is relatively cheap, thanks to hstr. pub src: Str, } diff --git a/crates/swc_common/Cargo.toml b/crates/swc_common/Cargo.toml index 1fd3bf0a01e9..ce249b825bc8 100644 --- a/crates/swc_common/Cargo.toml +++ b/crates/swc_common/Cargo.toml @@ -57,7 +57,6 @@ rustc-hash = "1.1.0" serde = { version = "1.0.119", features = ["derive"] } siphasher = "0.3.9" sourcemap = { version = "6", optional = true } -string_cache = "0.8.7" termcolor = { version = "1.0", optional = true } tracing = "0.1.37" unicode-width = "0.1.4" diff --git a/crates/swc_common/src/eq.rs b/crates/swc_common/src/eq.rs index bf2785484553..43d49aacf975 100644 --- a/crates/swc_common/src/eq.rs +++ b/crates/swc_common/src/eq.rs @@ -1,7 +1,6 @@ -use std::{cell::RefCell, cmp::PartialEq, rc::Rc, sync::Arc}; +use std::{cell::RefCell, rc::Rc, sync::Arc}; use num_bigint::BigInt; -use string_cache::Atom; use crate::{BytePos, Span, SyntaxContext}; @@ -136,20 +135,6 @@ eq!(isize, i8, i16, i32, i64, i128); eq!(f32, f64); eq!(char, str, String); -impl EqIgnoreSpan for Atom { - #[inline] - fn eq_ignore_span(&self, other: &Self) -> bool { - self == other - } -} - -impl TypeEq for Atom { - #[inline] - fn type_eq(&self, other: &Self) -> bool { - self == other - } -} - macro_rules! deref { ($T:ident) => { impl EqIgnoreSpan for $T