Skip to content

Commit

Permalink
prefer atom to string cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
XantreDev committed Jan 12, 2024
1 parent dce6616 commit 095182f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()),
);
}
}
Expand All @@ -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
}
Expand Down

0 comments on commit 095182f

Please sign in to comment.