From 09d2124d0f90bfe2c4f4f1e3d8b382ac71d1d549 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 29 Apr 2021 11:53:57 -0500 Subject: [PATCH] perf(parser): Limit inner-loop assers --- crates/typos/src/tokens.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/typos/src/tokens.rs b/crates/typos/src/tokens.rs index 8eb9fef..dfb1939 100644 --- a/crates/typos/src/tokens.rs +++ b/crates/typos/src/tokens.rs @@ -185,7 +185,7 @@ mod parser { std::iter::from_fn(move || match next_literal(input) { Ok((i, o)) => { input = i; - assert_ne!(o, ""); + debug_assert_ne!(o, ""); Some(o) } _ => None, @@ -333,7 +333,7 @@ impl<'s> Iterator for SplitIdent<'s> { while let Some((i, c)) = self.char_indices.next() { let cur_mode = WordMode::classify(c); if cur_mode == WordMode::Boundary { - assert!(self.start_mode == WordMode::Boundary); + debug_assert!(self.start_mode == WordMode::Boundary); continue; } if self.start_mode == WordMode::Boundary {