Skip to content

Commit

Permalink
Apply clippy suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Oct 18, 2021
1 parent 848f692 commit e87c4cb
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions packages/transformers/js/core/src/hoist.rs
Expand Up @@ -916,25 +916,23 @@ impl<'a> Fold for Hoist<'a> {
};

let ident = BindingIdent::from(self.get_export_ident(member.span, &key));
if self.collect.static_cjs_exports {
if self.export_decls.insert(ident.id.sym.clone()) {
self
.hoisted_imports
.push(ModuleItem::Stmt(Stmt::Decl(Decl::Var(VarDecl {
declare: false,
kind: VarDeclKind::Var,
if self.collect.static_cjs_exports && self.export_decls.insert(ident.id.sym.clone()) {
self
.hoisted_imports
.push(ModuleItem::Stmt(Stmt::Decl(Decl::Var(VarDecl {
declare: false,
kind: VarDeclKind::Var,
span: node.span,
decls: vec![VarDeclarator {
definite: false,
span: node.span,
decls: vec![VarDeclarator {
definite: false,
span: node.span,
name: Pat::Ident(BindingIdent::from(Ident::new(
ident.id.sym.clone(),
DUMMY_SP,
))),
init: None,
}],
}))));
}
name: Pat::Ident(BindingIdent::from(Ident::new(
ident.id.sym.clone(),
DUMMY_SP,
))),
init: None,
}],
}))));
}

return AssignExpr {
Expand Down

0 comments on commit e87c4cb

Please sign in to comment.