mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
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:
parent
4425b961cd
commit
27102df476
1 changed files with 2 additions and 10 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue