diff options
| author | Ralf Jung <post@ralfj.de> | 2024-03-10 17:12:27 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-03-10 18:07:34 +0100 |
| commit | 81ebaf27cb4301a833f5a4ba1f4a6e63cfcc32b3 (patch) | |
| tree | cb5f57147734ef567f69754748a0f446634905ec /library/alloc | |
| parent | cdb775cab50311de54ccf3a07b331cc56b0da436 (diff) | |
| download | rust-81ebaf27cb4301a833f5a4ba1f4a6e63cfcc32b3.tar.gz rust-81ebaf27cb4301a833f5a4ba1f4a6e63cfcc32b3.zip | |
RawVec::into_box: avoid unnecessary intermediate reference
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/raw_vec.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs index ace73c0fdaa..0ee293db73a 100644 --- a/library/alloc/src/raw_vec.rs +++ b/library/alloc/src/raw_vec.rs @@ -5,7 +5,6 @@ use core::cmp; use core::hint; use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties}; use core::ptr::{self, NonNull, Unique}; -use core::slice; #[cfg(not(no_global_oom_handling))] use crate::alloc::handle_alloc_error; @@ -192,7 +191,7 @@ impl<T, A: Allocator> RawVec<T, A> { let me = ManuallyDrop::new(self); unsafe { - let slice = slice::from_raw_parts_mut(me.ptr() as *mut MaybeUninit<T>, len); + let slice = ptr::slice_from_raw_parts_mut(me.ptr() as *mut MaybeUninit<T>, len); Box::from_raw_in(slice, ptr::read(&me.alloc)) } } |
