diff options
author | Blaž Hrastnik | 2021-12-06 03:48:25 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-12-06 03:48:25 +0000 |
commit | a2b22ec15207926acf9bbf6617492925a6e50d27 (patch) | |
tree | 3026c4e0f92433510db13ba86eefa13d83568198 /helix-view | |
parent | cab09093dd5bf9b4707bfdfd8529b348c02670ea (diff) |
Use binary_search when looking up diagnostics
They're sorted by range so they should also be sorted by line
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/gutter.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs index 86773c1d..4c0edd90 100644 --- a/helix-view/src/gutter.rs +++ b/helix-view/src/gutter.rs @@ -22,7 +22,7 @@ pub fn diagnostic<'doc>( Box::new(move |line: usize, _selected: bool, out: &mut String| { use helix_core::diagnostic::Severity; - if let Some(diagnostic) = diagnostics.iter().find(|d| d.line == line) { + if let Some(diagnostic) = diagnostics.binary_search_by_key(&line, |d| d.line) { write!(out, "●").unwrap(); return Some(match diagnostic.severity { Some(Severity::Error) => error, |