diff --git a/crates/oxc_data_structures/src/stack/non_empty.rs b/crates/oxc_data_structures/src/stack/non_empty.rs index 31b1eedfafa06..82754d7a710c0 100644 --- a/crates/oxc_data_structures/src/stack/non_empty.rs +++ b/crates/oxc_data_structures/src/stack/non_empty.rs @@ -100,7 +100,9 @@ impl StackCommon for NonEmptyStack { // When stack has 1 entry, `start - cursor == 0`, so add 1 to get number of entries. // SAFETY: Capacity cannot exceed `Self::MAX_CAPACITY`, which is `<= isize::MAX`, // and offset can't exceed capacity, so `+ 1` cannot wrap around. - offset + 1 + // `checked_add(1).unwrap_unchecked()` instead of just `+ 1` to hint to compiler + // that return value can never be zero. + unsafe { offset.checked_add(1).unwrap_unchecked() } } }