mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 20:28:58 +00:00
refactor(index): shorten code and correct comment (#4905)
Style nit + comment correction. Plain `Box` is used everywhere else in this file, no need to fully specify `alloc::boxed::Box`.
This commit is contained in:
parent
a6967b30f3
commit
786bf07e45
1 changed files with 2 additions and 3 deletions
|
|
@ -343,12 +343,11 @@ impl<I: Idx, T> IndexVec<I, T> {
|
|||
self.raw.pop()
|
||||
}
|
||||
|
||||
/// Converts the vector into an owned IdxSlice, dropping excess capacity.
|
||||
/// Converts the vector into an owned [`IndexSlice`], dropping excess capacity.
|
||||
#[inline]
|
||||
pub fn into_boxed_slice(self) -> alloc::boxed::Box<IndexSlice<I, [T]>> {
|
||||
pub fn into_boxed_slice(self) -> Box<IndexSlice<I, [T]>> {
|
||||
let b = self.raw.into_boxed_slice();
|
||||
// SAFETY: `IndexSlice` is a thin wrapper around `[T]` with the added marker for the index.
|
||||
|
||||
unsafe { Box::from_raw(Box::into_raw(b) as *mut IndexSlice<I, [T]>) }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue