From 50ecade892544cfee5b3a5647ec5060067ff65ff Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Tue, 15 Oct 2024 01:20:31 +0000 Subject: [PATCH] refactor(transformer): `HelperLoader` common transform: remove `Rc`s (#6564) State is uniquely owned by `HelperLoaderStore`, so no need for `Rc`. --- crates/oxc_transformer/src/common/helper_loader.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/oxc_transformer/src/common/helper_loader.rs b/crates/oxc_transformer/src/common/helper_loader.rs index 42e4c053e8c52..453e692ab25fa 100644 --- a/crates/oxc_transformer/src/common/helper_loader.rs +++ b/crates/oxc_transformer/src/common/helper_loader.rs @@ -62,7 +62,6 @@ use std::{ borrow::Cow, cell::{Cell, RefCell}, - rc::Rc, }; use oxc_allocator::Vec; @@ -154,9 +153,9 @@ pub struct HelperLoaderStore<'a> { mode: HelperLoaderMode, module_name: Cow<'static, str>, /// Symbol ID for the `babelHelpers`. - babel_helpers_symbol_id: Rc>>, + babel_helpers_symbol_id: Cell>, /// Loaded helpers, determined what helpers are loaded and what imports should be added. - loaded_helpers: Rc>>, + loaded_helpers: RefCell>, } // Public methods @@ -165,8 +164,8 @@ impl<'a> HelperLoaderStore<'a> { Self { mode: options.mode, module_name: options.module_name.clone(), - loaded_helpers: Rc::new(RefCell::new(FxHashMap::default())), - babel_helpers_symbol_id: Rc::new(Cell::new(None)), + loaded_helpers: RefCell::new(FxHashMap::default()), + babel_helpers_symbol_id: Cell::new(None), } }