Skip to content

Commit

Permalink
Reduce clone
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 26, 2025
1 parent 6f781d8 commit 28b03ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/swc_ecma_usage_analyzer/src/alias/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ pub struct InfectionCollector<'a> {
}

impl InfectionCollector<'_> {
fn add_id(&mut self, e: &Id) {
if self.exclude.contains(e) {
fn add_id(&mut self, e: Id) {
if self.exclude.contains(&e) {
return;
}

Expand All @@ -109,7 +109,7 @@ impl InfectionCollector<'_> {
}

self.accesses.insert((
e.clone(),
e,
if self.ctx.is_callee {
AccessKind::Call
} else {
Expand Down Expand Up @@ -184,14 +184,14 @@ impl Visit for InfectionCollector<'_> {
}

fn visit_ident(&mut self, n: &Ident) {
self.add_id(&n.to_id());
self.add_id(n.to_id());
}

fn visit_expr(&mut self, e: &Expr) {
match e {
Expr::Ident(i) => {
if self.ctx.track_expr_ident {
self.add_id(&i.to_id());
self.add_id(i.to_id());
}
}

Expand Down

0 comments on commit 28b03ea

Please sign in to comment.