Remove unnecessary reference

This commit is contained in:
Mahmoud Al-Qudsi 2024-08-20 14:48:59 -05:00
parent 6c37103b7c
commit f3d59abc46

View file

@ -288,11 +288,11 @@ fn unescape_yaml_fish_2_0(s: &[u8]) -> Vec<u8> {
// performance of this function. // performance of this function.
let to_copy = chars.by_ref().take_while(|b| *b != b'\\').count(); let to_copy = chars.by_ref().take_while(|b| *b != b'\\').count();
unsafe { unsafe {
let src = &s[src_idx..].as_ptr(); let src = s[src_idx..].as_ptr();
// Can use the following when feature(maybe_uninit_slice) is stabilized: // Can use the following when feature(maybe_uninit_slice) is stabilized:
// let dst = std::mem::MaybeUninit::slice_as_mut_ptr(&mut result[dst_idx..]); // let dst = std::mem::MaybeUninit::slice_as_mut_ptr(&mut result[dst_idx..]);
let dst = result[dst_idx..].as_mut_ptr().cast(); let dst = result[dst_idx..].as_mut_ptr().cast();
std::ptr::copy_nonoverlapping(*src, dst, to_copy); std::ptr::copy_nonoverlapping(src, dst, to_copy);
} }
dst_idx += to_copy; dst_idx += to_copy;