Skip to content

Commit

Permalink
refactor(data_structures): CodeBuffer::print_str use `Vec::extend_f…
Browse files Browse the repository at this point in the history
…rom_slice`
  • Loading branch information
overlookmotel committed Feb 24, 2025
1 parent 8bde4e3 commit 1aeeeab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_data_structures/src/code_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl CodeBuffer {
#[inline]
pub fn print_char(&mut self, ch: char) {
let mut b = [0; 4];
self.buf.extend(ch.encode_utf8(&mut b).as_bytes());
self.buf.extend_from_slice(ch.encode_utf8(&mut b).as_bytes());
}

/// Push a string into the buffer.
Expand All @@ -313,7 +313,7 @@ impl CodeBuffer {
/// ```
#[inline]
pub fn print_str<S: AsRef<str>>(&mut self, s: S) {
self.buf.extend(s.as_ref().as_bytes());
self.buf.extend_from_slice(s.as_ref().as_bytes());
}

/// Push a sequence of ASCII characters into the buffer.
Expand Down

0 comments on commit 1aeeeab

Please sign in to comment.