Skip to content

Commit ccf2669

Browse files
committed
Replace unsafe IVec code with equivalent safe code
1 parent 37752ce commit ccf2669

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/ivec.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,8 @@ impl IVec {
109109

110110
fn inline(slice: &[u8]) -> Self {
111111
assert!(is_inline_candidate(slice.len()));
112-
113112
let mut data = Inner::default();
114-
115-
#[allow(unsafe_code)]
116-
unsafe {
117-
std::ptr::copy_nonoverlapping(
118-
slice.as_ptr(),
119-
data.as_mut_ptr(),
120-
slice.len(),
121-
);
122-
}
123-
113+
data[..slice.len()].copy_from_slice(slice);
124114
Self(IVecInner::Inline(u8::try_from(slice.len()).unwrap(), data))
125115
}
126116

0 commit comments

Comments
 (0)