From 3c6dc0f89dc9c2902d71e8639b4913917a396f8a Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Thu, 3 Jun 2021 11:45:10 +0200 Subject: Apply a few clippy suggestions --- crates/test_utils/src/lib.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'crates/test_utils') diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index bd017567c..ac5a9509d 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -238,14 +238,9 @@ fn extract_line_annotations(mut line: &str) -> Vec { let mut res = Vec::new(); let mut offset: TextSize = 0.into(); let marker: fn(char) -> bool = if line.contains('^') { |c| c == '^' } else { |c| c == '|' }; - loop { - match line.find(marker) { - Some(idx) => { - offset += TextSize::try_from(idx).unwrap(); - line = &line[idx..]; - } - None => break, - }; + while let Some(idx) = line.find(marker) { + offset += TextSize::try_from(idx).unwrap(); + line = &line[idx..]; let mut len = line.chars().take_while(|&it| it == '^').count(); let mut continuation = false; -- cgit v1.2.3