diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 3d8f3e0de4683..13e90cfbbd4f9 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -223,9 +223,7 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer } match *part { TracePathPart::Key(key) => { - self.fixes_buffer.print_ascii_byte(b'"'); - self.fixes_buffer.print_str(key); - self.fixes_buffer.print_ascii_byte(b'"'); + self.fixes_buffer.print_strs_array(["\"", key, "\""]); } TracePathPart::Index(index) => { let mut buffer = ItoaBuffer::new(); diff --git a/crates/oxc_estree/src/serialize/strings.rs b/crates/oxc_estree/src/serialize/strings.rs index 0f8a0a823cdc7..46107fe1b4f21 100644 --- a/crates/oxc_estree/src/serialize/strings.rs +++ b/crates/oxc_estree/src/serialize/strings.rs @@ -26,10 +26,7 @@ pub struct JsonSafeString<'s>(pub &'s str); impl ESTree for JsonSafeString<'_> { #[inline(always)] fn serialize(&self, mut serializer: S) { - let buffer = serializer.buffer_mut(); - buffer.print_ascii_byte(b'"'); - buffer.print_str(self.0); - buffer.print_ascii_byte(b'"'); + serializer.buffer_mut().print_strs_array(["\"", self.0, "\""]); } } diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index af832c89a1d2b..bfc10e75ff3ba 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -98,9 +98,7 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, formatter.before_later_element(buffer); } - buffer.print_ascii_byte(b'"'); - buffer.print_str(key); - buffer.print_str("\":"); + buffer.print_strs_array(["\"", key, "\":"]); formatter.before_field_value(buffer); value.serialize(&mut *self.serializer); }