From cff2b8a260fa2cc7b4263a3277123a8e50a896ae Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Sun, 17 Nov 2024 19:28:36 +0000 Subject: [PATCH] refactor(ast): `AstBuilder::vec1` use `Vec::from_array_in` --- crates/oxc_ast/src/ast_builder_impl.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/oxc_ast/src/ast_builder_impl.rs b/crates/oxc_ast/src/ast_builder_impl.rs index 80937d8333c7db..80aeb1087ba954 100644 --- a/crates/oxc_ast/src/ast_builder_impl.rs +++ b/crates/oxc_ast/src/ast_builder_impl.rs @@ -56,9 +56,7 @@ impl<'a> AstBuilder<'a> { /// Create a new arena-allocated [`Vec`] initialized with a single element. #[inline] pub fn vec1(self, value: T) -> Vec<'a, T> { - let mut vec = self.vec_with_capacity(1); - vec.push(value); - vec + self.vec_from_array([value]) } /// Collect an iterator into a new arena-allocated [`Vec`].