Skip to content

Commit

Permalink
refactor(isolated_declarations): do not copy Vec unnecessarily (#7332)
Browse files Browse the repository at this point in the history
This function receives an owned `oxc_allocator::Vec`. No need to copy the contents to a new `Vec` with `AstBuilder::vec_from_iter`, can just use the original.
  • Loading branch information
overlookmotel committed Nov 18, 2024
1 parent 44fd962 commit 1938a1d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions crates/oxc_isolated_declarations/src/declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@ impl<'a> IsolatedDeclarations<'a> {
decl: &VariableDeclaration<'a>,
declarations: oxc_allocator::Vec<'a, VariableDeclarator<'a>>,
) -> Box<'a, VariableDeclaration<'a>> {
self.ast.alloc_variable_declaration(
decl.span,
decl.kind,
self.ast.vec_from_iter(declarations),
self.is_declare(),
)
self.ast.alloc_variable_declaration(decl.span, decl.kind, declarations, self.is_declare())
}

pub(crate) fn transform_variable_declarator(
Expand Down

0 comments on commit 1938a1d

Please sign in to comment.