diff --git a/src/parser.rs b/src/parser.rs index df32f21..923024f 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -152,8 +152,8 @@ fn is_line_blank_or_whitespace(line: &str) -> bool { } fn is_line_footnote(line: &str) -> bool { - if line.starts_with('[') { - let mut chars = line[1..].chars(); + if let Some(rest) = line.strip_prefix('[') { + let mut chars = rest.chars(); if chars.next() == Some(']') { // Reject "[]" return false; @@ -245,8 +245,7 @@ fn line_as_list_item(line: &str) -> Option { let mut li_state = LiState::New; let mut ix_li_type_start = 0; let mut ix_li_content_start: Option = None; - let mut iter = line.char_indices(); - while let Some((ix, c)) = iter.next() { + for (ix, c) in line.char_indices() { match li_state { LiState::New | LiState::IndentSp1 | LiState::IndentSp2 => { ix_li_type_start = ix;