Skip to content

Commit

Permalink
refactor(index): shorten code and correct comment (#4905)
Browse files Browse the repository at this point in the history
Style nit + comment correction. Plain `Box` is used everywhere else in this file, no need to fully specify `alloc::boxed::Box`.
  • Loading branch information
overlookmotel committed Aug 14, 2024
1 parent a6967b3 commit 786bf07
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/oxc_index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]>) }
}

Expand Down

0 comments on commit 786bf07

Please sign in to comment.