Skip to content

Commit

Permalink
fix(ast): fix lifetimes on custom Serialize impls
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Feb 5, 2025
1 parent 5cb8466 commit 49433c4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions crates/oxc_ast/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ impl From<&NullLiteral> for ESTreeLiteral<'_, ()> {
}
}

impl<'a> From<&'a NumericLiteral<'a>> for ESTreeLiteral<'a, f64> {
fn from(lit: &'a NumericLiteral) -> Self {
impl<'a> From<&NumericLiteral<'a>> for ESTreeLiteral<'a, f64> {
fn from(lit: &NumericLiteral<'a>) -> Self {
Self {
span: lit.span,
value: lit.value,
Expand All @@ -61,20 +61,20 @@ impl<'a> From<&'a NumericLiteral<'a>> for ESTreeLiteral<'a, f64> {
}
}

impl<'a> From<&'a StringLiteral<'a>> for ESTreeLiteral<'a, &'a str> {
fn from(lit: &'a StringLiteral) -> Self {
impl<'a> From<&StringLiteral<'a>> for ESTreeLiteral<'a, &'a str> {
fn from(lit: &StringLiteral<'a>) -> Self {
Self {
span: lit.span,
value: &lit.value,
value: lit.value.as_str(),
raw: lit.raw.as_ref().map(Atom::as_str),
bigint: None,
regex: None,
}
}
}

impl<'a> From<&'a BigIntLiteral<'a>> for ESTreeLiteral<'a, ()> {
fn from(lit: &'a BigIntLiteral) -> Self {
impl<'a> From<&BigIntLiteral<'a>> for ESTreeLiteral<'a, ()> {
fn from(lit: &BigIntLiteral<'a>) -> Self {
let src = &lit.raw.strip_suffix('n').unwrap().cow_replace('_', "");

let src = match lit.base {
Expand Down Expand Up @@ -111,8 +111,8 @@ pub struct SerRegExpValue {
#[allow(clippy::empty_structs_with_brackets)]
pub struct EmptyObject {}

impl<'a> From<&'a RegExpLiteral<'a>> for ESTreeLiteral<'a, Option<EmptyObject>> {
fn from(lit: &'a RegExpLiteral) -> Self {
impl<'a> From<&RegExpLiteral<'a>> for ESTreeLiteral<'a, Option<EmptyObject>> {
fn from(lit: &RegExpLiteral<'a>) -> Self {
Self {
span: lit.span,
raw: lit.raw.as_ref().map(Atom::as_str),
Expand Down

0 comments on commit 49433c4

Please sign in to comment.