Dependency of qbsdiff by the same author.
Noticed 2 patterns:
std::ptr::copy_nonoverlapping(&src_slice[i] as *const T, &mut dst_slice[j] as *mut T, n)
All non-UB uses can be replaced with dst.slice[j..j+n].copy_from_slice(src_slice[i..i+n]).
std::ptr::copy(&s[i] as *const T, &mut s[j] as *mut T, n)
Same idea, non-UB uses can be replaced with s.copy_within(i..i+n, j).
If the ranges are non-overlapping, it might be faster to use slice::split_at_mut and copy_from_slice (resulting in a call to std::ptr::copy_nonoverlapping)
Should we request a clippy lint?
Fixes sent upstream: hucsmn/suffix_array#1
Dependency of
qbsdiffby the same author.Noticed 2 patterns:
std::ptr::copy_nonoverlapping(&src_slice[i] as *const T, &mut dst_slice[j] as *mut T, n)All non-UB uses can be replaced with
dst.slice[j..j+n].copy_from_slice(src_slice[i..i+n]).std::ptr::copy(&s[i] as *const T, &mut s[j] as *mut T, n)Same idea, non-UB uses can be replaced with
s.copy_within(i..i+n, j).If the ranges are non-overlapping, it might be faster to use
slice::split_at_mutandcopy_from_slice(resulting in a call tostd::ptr::copy_nonoverlapping)Should we request a clippy lint?
Fixes sent upstream: hucsmn/suffix_array#1