Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 3696992

Browse files
author
Hendrik van Antwerpen
committed
Use truncate instead
1 parent 2edda57 commit 3696992

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

stack-graphs/src/arena.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ impl<T> Arena<T> {
185185
/// the arena are invalid.
186186
#[inline(always)]
187187
pub fn clear(&mut self) {
188-
self.items.clear();
189-
self.items.push(MaybeUninit::uninit());
188+
self.items.truncate(1);
190189
}
191190

192191
/// Adds a new instance to this arena, returning a stable handle to it.
@@ -292,8 +291,7 @@ impl<H, T> SupplementalArena<H, T> {
292291
/// all previous handles into the arena are invalid.
293292
#[inline(always)]
294293
pub fn clear(&mut self) {
295-
self.items.clear();
296-
self.items.push(MaybeUninit::uninit());
294+
self.items.truncate(1);
297295
}
298296

299297
/// Creates a new, empty supplemental arena, preallocating enough space to store supplemental

0 commit comments

Comments
 (0)