set_len(0) does not create uninitialized elements. Fixes a false positive with
the following pattern:
fn copy_slice_into_vec(dst: &mut Vec<u8>, src: &[u8]) {
dst.reserve(src.len().saturating_sub(dst.len()));
unsafe {
dst.set_len(0);
std::ptr::copy_nonoverlapping(src.as_ptr(), dst.as_mut_ptr(), src.len());
dst.set_len(src.len());
}
}
|
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||