mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29: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:
1 parent
4425b961cd
commit
27102df476
1 file changed
+2
-10
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user