Skip to content

Commit 4ba8345

Browse files
committed
Don't zero the array on initialization
Using `mem::uninitialized` is potentially faster than `mem::zeroed`, and doesn't remove any safety (since both uninitialized memory and zeroed memory are unsafe to read from in general).
1 parent d389f3a commit 4ba8345

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<A: Array> SmallVec<A> {
202202
unsafe {
203203
SmallVec {
204204
len: 0,
205-
data: Inline { array: mem::zeroed() },
205+
data: Inline { array: mem::uninitialized() },
206206
}
207207
}
208208
}

0 commit comments

Comments
 (0)