aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-03 13:09:10 +0100
committerGitHub <[email protected]>2021-06-03 13:09:10 +0100
commit48ea50bf04a1bd12999bd9e27558ac31988c7228 (patch)
tree64b223398a3b62b8cc4e86239495a5b3e446441a /crates/test_utils/src/lib.rs
parentc7eb19ebf9d42cada8cb532c6b3cb0e11a531b93 (diff)
parenta1e650082b068919f9515330e6d0977c09af190f (diff)
Merge #9124
9124: Apply a few clippy suggestions r=lnicola a=clemenswasser Co-authored-by: Clemens Wasser <[email protected]>
Diffstat (limited to 'crates/test_utils/src/lib.rs')
-rw-r--r--crates/test_utils/src/lib.rs11
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;