diff options
| author | bors <bors@rust-lang.org> | 2022-09-23 15:37:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-23 15:37:13 +0000 |
| commit | dc14531fe9fca306fa56ab38191e3aadfa4e85c6 (patch) | |
| tree | 12e29e6af047c72eccace0230ecac2f0e27cfecf /src/test/debuginfo | |
| parent | 61fd2a8c6f8336ea12fe5b6fd1051fcf5a7b915e (diff) | |
| parent | 49319b4206cbde83e0113c024b09275677ab8d74 (diff) | |
| download | rust-dc14531fe9fca306fa56ab38191e3aadfa4e85c6.tar.gz rust-dc14531fe9fca306fa56ab38191e3aadfa4e85c6.zip | |
Auto merge of #9519 - alessandrod:uninit-set-len-0, r=llogiq
uninit_vec: fix false positive with set_len(0)
`set_len(0)` does not create uninitialized elements. Fixes a false positive with the following pattern:
```rust
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());
}
}
```
zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/uninit_vec.20and.20set_len.280.29
changelog: FP: [`uninit_vec`]: No longer lints `Vec::set_len(0)`
Diffstat (limited to 'src/test/debuginfo')
0 files changed, 0 insertions, 0 deletions
