From 46e2e27735ca70f4ce0235165ab51183839a0014 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:02:52 +0000 Subject: [PATCH] feat(data_structures): implement `Default` for `NonEmptyStack` (#7946) Implement `Default` for `NonEmptyStack` where `T: Default`. --- crates/oxc_data_structures/src/stack/non_empty.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/oxc_data_structures/src/stack/non_empty.rs b/crates/oxc_data_structures/src/stack/non_empty.rs index 5e80fa53725ba..0f5bee8ae927a 100644 --- a/crates/oxc_data_structures/src/stack/non_empty.rs +++ b/crates/oxc_data_structures/src/stack/non_empty.rs @@ -366,6 +366,12 @@ impl DerefMut for NonEmptyStack { } } +impl Default for NonEmptyStack { + fn default() -> Self { + Self::new(T::default()) + } +} + #[cfg(test)] mod tests { use super::*;