From aebe7a0e7bbc9876fbce41f7e72112ca7f6f3f8e Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 24 Jun 2023 16:06:36 -0700 Subject: [PATCH] Eliminate unneeded peekability on cooked string iterators --- src/parse.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parse.rs b/src/parse.rs index 6b5ad7d..9bf5bd0 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -372,7 +372,7 @@ fn string(input: Cursor) -> Result { } fn cooked_string(mut input: Cursor) -> Result { - let mut chars = input.char_indices().peekable(); + let mut chars = input.char_indices(); while let Some((i, ch)) = chars.next() { match ch { @@ -396,7 +396,7 @@ fn cooked_string(mut input: Cursor) -> Result { 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, }, @@ -540,7 +540,7 @@ fn raw_c_string(input: Cursor) -> Result { } fn cooked_c_string(mut input: Cursor) -> Result { - let mut chars = input.char_indices().peekable(); + let mut chars = input.char_indices(); while let Some((i, ch)) = chars.next() { match ch { @@ -566,7 +566,7 @@ fn cooked_c_string(mut input: Cursor) -> Result { 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, },