diff --git a/crates/oxc_data_structures/src/stack/non_empty.rs b/crates/oxc_data_structures/src/stack/non_empty.rs index 2e2d6234a98ee..7bbe4e00f8d92 100644 --- a/crates/oxc_data_structures/src/stack/non_empty.rs +++ b/crates/oxc_data_structures/src/stack/non_empty.rs @@ -216,20 +216,6 @@ impl NonEmptyStack { Self { cursor: start, start, end } } - /// Get reference to first value on stack. - #[inline] - pub fn first(&self) -> &T { - // SAFETY: All methods ensure `self.start` always points to a valid initialized `T` - unsafe { self.start.as_ref() } - } - - /// Get mutable reference to first value on stack. - #[inline] - pub fn first_mut(&mut self) -> &mut T { - // SAFETY: All methods ensure `self.start` always points to a valid initialized `T` - unsafe { self.start.as_mut() } - } - /// Get reference to last value on stack. #[inline] pub fn last(&self) -> &T { diff --git a/crates/oxc_transformer/src/typescript/enum.rs b/crates/oxc_transformer/src/typescript/enum.rs index 3769870bb0bf7..793219708be6b 100644 --- a/crates/oxc_transformer/src/typescript/enum.rs +++ b/crates/oxc_transformer/src/typescript/enum.rs @@ -574,7 +574,9 @@ impl IdentifierReferenceRename<'_, '_> { // } // } // ``` - *self.scope_stack.first() == symbol_scope_id + // + // `NonEmptyStack` guarantees that the stack is not empty. + *self.scope_stack.first().unwrap() == symbol_scope_id // The resolved symbol is declared outside the enum, // and we have checked that the name exists in previous_enum_members: //