mirror of
https://github.com/servo/servo.git
synced 2025-07-30 02:30:21 +01:00
Stylo: replace uses of mem::uninitialized with MaybeUninit
MozReview-Commit-ID: KGhYL6DJRaR
This commit is contained in:
parent
00b3fb49c4
commit
17ec774a49
9 changed files with 60 additions and 68 deletions
|
@ -202,7 +202,8 @@ impl WeakAtom {
|
|||
where
|
||||
F: FnOnce(&str) -> Output,
|
||||
{
|
||||
let mut buffer: [u8; 64] = unsafe { mem::uninitialized() };
|
||||
let mut buffer = mem::MaybeUninit::<[u8; 64]>::uninit();
|
||||
let buffer = unsafe { &mut *buffer.as_mut_ptr() };
|
||||
|
||||
// The total string length in utf16 is going to be less than or equal
|
||||
// the slice length (each utf16 character is going to take at least one
|
||||
|
@ -271,7 +272,8 @@ impl WeakAtom {
|
|||
}
|
||||
|
||||
let slice = self.as_slice();
|
||||
let mut buffer: [u16; 64] = unsafe { mem::uninitialized() };
|
||||
let mut buffer = mem::MaybeUninit::<[u16; 64]>::uninit();
|
||||
let buffer = unsafe { &mut *buffer.as_mut_ptr() };
|
||||
let mut vec;
|
||||
let mutable_slice = if let Some(buffer_prefix) = buffer.get_mut(..slice.len()) {
|
||||
buffer_prefix.copy_from_slice(slice);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue