Skip to content

Commit

Permalink
refactor(codegen): rename vars in CodeBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Oct 13, 2024
1 parent eee1c18 commit aac6c82
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/oxc_codegen/src/code_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ impl CodeBuffer {
/// code.print_ascii([b'f', b'o', b'o'].into_iter());
/// assert_eq!(String::from(code), "foo");
/// ```
pub fn print_ascii<I>(&mut self, chars: I)
pub fn print_ascii<I>(&mut self, bytes: I)
where
I: IntoIterator<Item = u8>,
{
let iter = chars.into_iter();
let iter = bytes.into_iter();
let hint = iter.size_hint();
self.buf.reserve(hint.1.unwrap_or(hint.0));
for c in iter {
Expand Down Expand Up @@ -355,12 +355,12 @@ impl AsRef<[u8]> for CodeBuffer {

impl From<CodeBuffer> for String {
#[inline]
fn from(printer: CodeBuffer) -> Self {
fn from(buffer: CodeBuffer) -> Self {
if cfg!(debug_assertions) {
String::from_utf8(printer.buf).unwrap()
String::from_utf8(buffer.buf).unwrap()
} else {
// SAFETY: `buf` is valid UTF-8 because of invariants upheld by `CodeBuffer`
unsafe { String::from_utf8_unchecked(printer.buf) }
unsafe { String::from_utf8_unchecked(buffer.buf) }
}
}
}
Expand Down

0 comments on commit aac6c82

Please sign in to comment.