Skip to content

Commit

Permalink
feat(data_structures): implement Default for NonEmptyStack (#7946)
Browse files Browse the repository at this point in the history
Implement `Default` for `NonEmptyStack<T>` where `T: Default`.
  • Loading branch information
overlookmotel committed Dec 16, 2024
1 parent ff2a68f commit 46e2e27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/oxc_data_structures/src/stack/non_empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@ impl<T> DerefMut for NonEmptyStack<T> {
}
}

impl<T: Default> Default for NonEmptyStack<T> {
fn default() -> Self {
Self::new(T::default())
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 46e2e27

Please sign in to comment.