From 46b06372e37e87391701e9dbb681d91a1e49145f Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 18 Feb 2026 12:07:42 -0800 Subject: [PATCH] Add a `clear` method to our OOM-handling `Vec` --- crates/core/src/alloc/vec.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/core/src/alloc/vec.rs b/crates/core/src/alloc/vec.rs index 681371f03cc8..c1cd3d3360a3 100644 --- a/crates/core/src/alloc/vec.rs +++ b/crates/core/src/alloc/vec.rs @@ -288,6 +288,11 @@ impl Vec { // use `std`'s `into_boxed_slice` without fear of `realloc`. Ok(self.inner.into_boxed_slice()) } + + /// Same as [`std::vec::Vec::clear`]. + pub fn clear(&mut self) { + self.inner.clear(); + } } impl Deref for Vec {