From 32f13332946ba5aa2b0f3d1ce907537c0cacaf6e Mon Sep 17 00:00:00 2001 From: Mikkel Kjeldsen Date: Fri, 13 Oct 2023 07:18:27 +0200 Subject: [PATCH 1/2] Fix clippy::manual_strip --- src/parser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index df32f21..d7f6c00 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; From 96f121a21513b077e67c0fd21533a1c9212a01d2 Mon Sep 17 00:00:00 2001 From: Mikkel Kjeldsen Date: Fri, 13 Oct 2023 07:18:33 +0200 Subject: [PATCH 2/2] Fix clippy::while_let_on_iterator --- src/parser.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index d7f6c00..923024f 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -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;