From 1938a1d6d94c5c3d401340d78457f27f6d57f346 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 18 Nov 2024 02:28:38 +0000 Subject: [PATCH] refactor(isolated_declarations): do not copy `Vec` unnecessarily (#7332) 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. --- crates/oxc_isolated_declarations/src/declaration.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/oxc_isolated_declarations/src/declaration.rs b/crates/oxc_isolated_declarations/src/declaration.rs index c5ef8fcb8..701e1b5da 100644 --- a/crates/oxc_isolated_declarations/src/declaration.rs +++ b/crates/oxc_isolated_declarations/src/declaration.rs @@ -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(