diff --git a/src/parse.rs b/src/parse.rs index 62ad56e..c4466a4 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -78,14 +78,11 @@ fn nodes_from_str(s: &str) -> Result, Error> { let mut nodes = Vec::new(); let mut state = ParsingState::default(); - let is_ignored_char = |c: &char| match c { - ' ' | '&' => false, - _ => true, - }; + let is_ignored_char = |c: &char| !matches!(c, ' ' | '&'); let filtered_string: String = s.chars().filter(is_ignored_char).collect(); - for (i, c) in filtered_string.chars().enumerate() { + for (i, c) in filtered_string.char_indices() { let mut start = false; match state { ParsingState::Start => start = true,