From 85641d81e3c36a224251eea1c7609440b6172489 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Fri, 13 Dec 2024 14:12:01 +0000 Subject: [PATCH] refactor(transformer/class-properties): re-use existing `Vec` --- crates/oxc_transformer/src/es2022/class_properties/supers.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/oxc_transformer/src/es2022/class_properties/supers.rs b/crates/oxc_transformer/src/es2022/class_properties/supers.rs index 40e8168cda9767..c7a4b43065ad44 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/supers.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/supers.rs @@ -98,9 +98,8 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { arguments: &mut ArenaVec<'a, Argument<'a>>, ctx: &mut TraverseCtx<'a>, ) { - let owned_arguments = ctx.ast.move_vec(arguments); - let elements = - ctx.ast.vec_from_iter(owned_arguments.into_iter().map(ArrayExpressionElement::from)); + let elements = arguments.drain(..).map(ArrayExpressionElement::from); + let elements = ctx.ast.vec_from_iter(elements); let array = ctx.ast.expression_array(SPAN, elements, None); arguments.push(Argument::from(array)); }