Skip to content

Commit

Permalink
refactor(codegen): rename CodeBuffer::print_bytes_unchecked method (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Oct 13, 2024
1 parent 782f0a7 commit 51fc63d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions crates/oxc_codegen/src/code_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl CodeBuffer {
/// It is safe for a single call to temporarily result in invalid UTF-8, as long as
/// UTF-8 integrity is restored before calls to any other `print_*` method or
/// [`take_source_text`]. This lets you, for example, print an 4-byte Unicode character
/// using 4 separate calls to this method. However, consider using [`print_unchecked`]
/// using 4 separate calls to this method. However, consider using [`print_bytes_unchecked`]
/// instead for that use case.
///
/// # Example
Expand All @@ -197,7 +197,7 @@ impl CodeBuffer {
/// [`print_ascii_byte`]: CodeBuffer::print_ascii_byte
/// [`print_char`]: CodeBuffer::print_char
/// [`take_source_text`]: CodeBuffer::take_source_text
/// [`print_unchecked`]: CodeBuffer::print_unchecked
/// [`print_bytes_unchecked`]: CodeBuffer::print_bytes_unchecked
#[inline]
pub unsafe fn print_byte_unchecked(&mut self, byte: u8) {
self.buf.push(byte);
Expand Down Expand Up @@ -287,13 +287,13 @@ impl CodeBuffer {
/// // Indent to a dynamic level.
/// // Sound because all elements in this iterator are ASCII characters.
/// unsafe {
/// code.print_unchecked(std::iter::repeat(b' ').take(4));
/// code.print_bytes_unchecked(std::iter::repeat(b' ').take(4));
/// }
/// ```
///
/// [`print_byte_unchecked`]: CodeBuffer::print_byte_unchecked
#[inline]
pub unsafe fn print_unchecked<I>(&mut self, bytes: I)
pub unsafe fn print_bytes_unchecked<I>(&mut self, bytes: I)
where
I: IntoIterator<Item = u8>,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl<'a> Codegen<'a> {
}
// SAFETY: this iterator only yields tabs, which are always valid ASCII characters.
unsafe {
self.code.print_unchecked(std::iter::repeat(b'\t').take(self.indent as usize));
self.code.print_bytes_unchecked(std::iter::repeat(b'\t').take(self.indent as usize));
}
}

Expand Down

0 comments on commit 51fc63d

Please sign in to comment.