From 095182ff97236f08d7dcb918e08a7c6a6e07d1a9 Mon Sep 17 00:00:00 2001 From: XantreGodlike Date: Fri, 12 Jan 2024 22:21:37 +0100 Subject: [PATCH] prefer atom to string cloning --- .../src/rules/import/no_named_as_default_member.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_linter/src/rules/import/no_named_as_default_member.rs b/crates/oxc_linter/src/rules/import/no_named_as_default_member.rs index d6c9350833bfbc..123961b484d1a3 100644 --- a/crates/oxc_linter/src/rules/import/no_named_as_default_member.rs +++ b/crates/oxc_linter/src/rules/import/no_named_as_default_member.rs @@ -49,7 +49,7 @@ impl Rule for NoNamedAsDefaultMember { fn run_once(&self, ctx: &LintContext<'_>) { let module_record = ctx.semantic().module_record(); - let mut has_members_map: HashMap<&Atom, (Ref<'_, Atom, _, _>, String)> = HashMap::default(); + let mut has_members_map: HashMap<&Atom, (Ref<'_, Atom, _, _>, Atom)> = HashMap::default(); for import_entry in &module_record.import_entries { let ImportImportName::Default(_) = import_entry.import_name else { continue; @@ -63,7 +63,7 @@ impl Rule for NoNamedAsDefaultMember { if !remote_module_record_ref.exported_bindings.is_empty() { has_members_map.insert( import_entry.local_name.name(), - (remote_module_record_ref, import_entry.module_request.name().to_string()), + (remote_module_record_ref, import_entry.module_request.name().to_owned()), ); } } @@ -74,7 +74,7 @@ impl Rule for NoNamedAsDefaultMember { let get_external_module_name_if_has_entry = |module_name: &Atom, entry_name: &Atom| { has_members_map.get(&module_name).and_then(|it| { if it.0.exported_bindings.contains_key(entry_name) { - Some(it.1.clone()) + Some(it.1.to_string()) } else { None }