Skip to content

Commit cee6da6

Browse files
CopilotDunqing
andcommitted
fix(codegen): resolve clippy warnings in CRLF handling code
Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
1 parent d287669 commit cee6da6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/oxc_codegen/src/comment.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ pub type CommentsMap = FxHashMap</* attached_to */ u32, Vec<Comment>>;
1313
/// This avoids creating empty strings between CR and LF characters.
1414
///
1515
/// # Example
16-
/// Standard split would turn "line1\r\nline2" into ["line1", "", "line2"] because
16+
/// Standard split would turn `"line1\r\nline2"` into `["line1", "", "line2"]` because
1717
/// it treats \r and \n as separate terminators. This iterator correctly produces
18-
/// ["line1", "line2"] by treating \r\n as a single terminator.
18+
/// `["line1", "line2"]` by treating \r\n as a single terminator.
1919
struct LineTerminatorSplitter<'a> {
2020
text: &'a str,
2121
position: usize,
@@ -36,9 +36,9 @@ impl<'a> Iterator for LineTerminatorSplitter<'a> {
3636
}
3737

3838
let start = self.position;
39-
let mut chars = self.text[self.position..].char_indices();
39+
let chars = self.text[self.position..].char_indices();
4040

41-
while let Some((i, c)) = chars.next() {
41+
for (i, c) in chars {
4242
if is_line_terminator(c) {
4343
let line = &self.text[start..start + i];
4444
self.position = start + i + c.len_utf8();

0 commit comments

Comments
 (0)