diff --git a/crates/oxc_allocator/src/vec.rs b/crates/oxc_allocator/src/vec.rs index d3d226121edb7..551faaf3f1613 100644 --- a/crates/oxc_allocator/src/vec.rs +++ b/crates/oxc_allocator/src/vec.rs @@ -95,7 +95,8 @@ impl<'alloc, T> Vec<'alloc, T> { #[inline] pub fn from_iter_in>(iter: I, allocator: &'alloc Allocator) -> Self { let iter = iter.into_iter(); - let capacity = iter.size_hint().1.unwrap_or(0); + let hint = iter.size_hint(); + let capacity = hint.1.unwrap_or(hint.0); let mut vec = vec::Vec::with_capacity_in(capacity, &**allocator); vec.extend(iter); Self(vec)