Skip to content

Commit

Permalink
Eliminate unneeded peekability on cooked string iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 24, 2023
1 parent e2923c3 commit aebe7a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ fn string(input: Cursor) -> Result<Cursor, Reject> {
}

fn cooked_string(mut input: Cursor) -> Result<Cursor, Reject> {
let mut chars = input.char_indices().peekable();
let mut chars = input.char_indices();

while let Some((i, ch)) = chars.next() {
match ch {
Expand All @@ -396,7 +396,7 @@ fn cooked_string(mut input: Cursor) -> Result<Cursor, Reject> {
Some((newline, ch @ '\n')) | Some((newline, ch @ '\r')) => {
input = input.advance(newline + 1);
trailing_backslash(&mut input, ch as u8)?;
chars = input.char_indices().peekable();
chars = input.char_indices();
}
_ => break,
},
Expand Down Expand Up @@ -540,7 +540,7 @@ fn raw_c_string(input: Cursor) -> Result<Cursor, Reject> {
}

fn cooked_c_string(mut input: Cursor) -> Result<Cursor, Reject> {
let mut chars = input.char_indices().peekable();
let mut chars = input.char_indices();

while let Some((i, ch)) = chars.next() {
match ch {
Expand All @@ -566,7 +566,7 @@ fn cooked_c_string(mut input: Cursor) -> Result<Cursor, Reject> {
Some((newline, ch @ '\n')) | Some((newline, ch @ '\r')) => {
input = input.advance(newline + 1);
trailing_backslash(&mut input, ch as u8)?;
chars = input.char_indices().peekable();
chars = input.char_indices();
}
_ => break,
},
Expand Down

0 comments on commit aebe7a0

Please sign in to comment.