refactor(napi): remove unnecessary custom Serialize impl for Atom (#3041)

Custom `Serialize` impl on `Atom` is not required - can just use serde
derive.
This commit is contained in:
overlookmotel 2024-04-21 06:04:51 +01:00 committed by GitHub
parent 4425b961cd
commit 27102df476
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'a> Atom<'a> {
#[inline]
pub fn as_str(&self) -> &str {