From e6280fef3277db5e880f1584d7ca3f9cccaa1655 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Fri, 3 Jul 2026 13:48:12 +0000 Subject: [PATCH] replace manual Vec::with_capacity --- src/util.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util.rs b/src/util.rs index 03d401f94..f707ee9d1 100644 --- a/src/util.rs +++ b/src/util.rs @@ -26,10 +26,8 @@ pub(crate) fn check_null_bytes(data: &[u8]) -> Result { } /// This function copies the slice into a vec and appends an element to its end. -/// The vec is allocated with reserve_exact. pub(crate) fn copy_and_push(data: &[T], to_push: T) -> alloc::vec::Vec { - let mut copy = alloc::vec::Vec::new(); - copy.reserve_exact(data.len() + 1); + let mut copy = alloc::vec::Vec::with_capacity(data.len() + 1); copy.extend_from_slice(data); copy.push(to_push); copy