Skip to content

skip_whitespace: use a non-ref callback #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ trait Unescape {
let _ = chars.next();
// skip whitespace for backslash newline, see [Rust language reference]
// (https://doc.rust-lang.org/reference/tokens.html#string-literals).
let mut callback_err = |range, err| callback(range, Err(err));
skip_ascii_whitespace(&mut chars, start, &mut callback_err);
let callback_err = |range, err| callback(range, Err(err));
skip_ascii_whitespace(&mut chars, start, callback_err);
continue;
} else {
Self::unescape_1(&mut chars)
Expand Down Expand Up @@ -444,7 +444,7 @@ fn unicode_escape(chars: &mut impl Iterator<Item = char>) -> Result<u32, EscapeE
/// Skip ASCII whitespace, except for the formfeed character
/// (see [this issue](https://github.com/rust-lang/rust/issues/136600)).
/// Warns on unescaped newline and following non-ASCII whitespace.
fn skip_ascii_whitespace<F>(chars: &mut Chars<'_>, start: usize, callback: &mut F)
fn skip_ascii_whitespace<F>(chars: &mut Chars<'_>, start: usize, mut callback: F)
where
F: FnMut(Range<usize>, EscapeError),
{
Expand Down