Skip to content

Commit

Permalink
Don't zero the array on initialization
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
mbrubeck committed Mar 22, 2017
1 parent d389f3a commit 4ba8345
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl<A: Array> SmallVec<A> {
unsafe {
SmallVec {
len: 0,
data: Inline { array: mem::zeroed() },
data: Inline { array: mem::uninitialized() },
}
}
}
Expand Down

0 comments on commit 4ba8345

Please sign in to comment.