From 2e6697e54ae55f80132ef849d2819b1b2c9a3a95 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sat, 4 Nov 2023 19:35:22 +0900 Subject: [PATCH] perfer `for` to `while` --- src/highlight.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/highlight.rs b/src/highlight.rs index 5444140..7dcf59e 100644 --- a/src/highlight.rs +++ b/src/highlight.rs @@ -169,12 +169,11 @@ impl<'a> LineHighlighter<'a> { o => o, }); - let mut boundaries = boundaries.into_iter(); let mut style = style_begin; let mut start = 0; let mut stack = vec![]; - while let Some((next_boundary, end)) = boundaries.next() { + for (next_boundary, end) in boundaries { if start < end { spans.push(Span::styled(builder.build(&line[start..end]), style)); }