diff options
Diffstat (limited to 'crates/test_utils/src/lib.rs')
-rw-r--r-- | crates/test_utils/src/lib.rs | 11 |
1 files changed, 3 insertions, 8 deletions
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<LineAnnotation> { | |||
238 | let mut res = Vec::new(); | 238 | let mut res = Vec::new(); |
239 | let mut offset: TextSize = 0.into(); | 239 | let mut offset: TextSize = 0.into(); |
240 | let marker: fn(char) -> bool = if line.contains('^') { |c| c == '^' } else { |c| c == '|' }; | 240 | let marker: fn(char) -> bool = if line.contains('^') { |c| c == '^' } else { |c| c == '|' }; |
241 | loop { | 241 | while let Some(idx) = line.find(marker) { |
242 | match line.find(marker) { | 242 | offset += TextSize::try_from(idx).unwrap(); |
243 | Some(idx) => { | 243 | line = &line[idx..]; |
244 | offset += TextSize::try_from(idx).unwrap(); | ||
245 | line = &line[idx..]; | ||
246 | } | ||
247 | None => break, | ||
248 | }; | ||
249 | 244 | ||
250 | let mut len = line.chars().take_while(|&it| it == '^').count(); | 245 | let mut len = line.chars().take_while(|&it| it == '^').count(); |
251 | let mut continuation = false; | 246 | let mut continuation = false; |