diff --git a/crates/oxc_span/src/atom.rs b/crates/oxc_span/src/atom.rs index e8b5cc20d..9c28b5cfc 100644 --- a/crates/oxc_span/src/atom.rs +++ b/crates/oxc_span/src/atom.rs @@ -20,18 +20,10 @@ pub const MAX_INLINE_LEN: usize = 16; /// Use [CompactStr] with [Atom::to_compact_str] or [Atom::into_compact_str] for the /// lifetimeless form. #[derive(Clone, Eq)] +#[cfg_attr(feature = "serialize", derive(Serialize))] +#[cfg_attr(feature = "serialize", serde(transparent))] pub struct Atom<'a>(&'a str); -#[cfg(feature = "serialize")] -impl<'a> Serialize for Atom<'a> { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_str(self.as_str()) - } -} - impl<'a> Atom<'a> { #[inline] pub fn as_str(&self) -> &str {