Skip to content

Commit

Permalink
fix(linter): fix no_unused_vars panic when encountering unicode (#5582)
Browse files Browse the repository at this point in the history
closes #4887
  • Loading branch information
Boshen committed Sep 7, 2024
1 parent 5f27551 commit 3b87ac4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ use super::{NoUnusedVars, Symbol};
// getting cast to a u32
#[allow(clippy::cast_possible_truncation)]
fn count_whitespace_or_commas<I: Iterator<Item = char>>(iter: I) -> u32 {
iter.take_while(|c| c.is_whitespace() || *c == ',').count() as u32
iter.take_while(|c| *c == ',' || c.is_whitespace()).map(|c| c.len_utf8() as u32).sum()
}

0 comments on commit 3b87ac4

Please sign in to comment.