convert to resize_with

This commit is contained in:
Lokathor 2020-07-25 15:53:27 -06:00
parent a2baf0abb3
commit 436abe3e89

View File

@ -91,7 +91,7 @@ pub fn try_zeroed_slice_box<T: Zeroable>(
if size_of::<T>() == 0 {
// This will not allocate but simple create a dangling slice pointer.
let mut vec = Vec::with_capacity(length);
vec.resize(length, T::zeroed());
vec.resize_with(length, || T::zeroed());
return Ok(vec.into_boxed_slice());
}
if length == 0 {