diff options
author | Philipp Mildenberger | 2023-03-18 16:00:57 +0000 |
---|---|---|
committer | Philipp Mildenberger | 2023-05-18 19:48:32 +0000 |
commit | 0637691eb1fb7e2055fc04a0209be94906c2bd1a (patch) | |
tree | 3b3e83c183fa6c9a1f8607c12f1af92ba032f236 | |
parent | dd2f74794a2ba6c45693d218079349d27828caec (diff) |
Use DoubleEndedIterator instead of collect to Vec for reversing
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
-rw-r--r-- | helix-term/src/commands.rs | 2 | ||||
-rw-r--r-- | helix-view/src/document.rs | 2 |
2 files changed, 1 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 27f289f0..14a68490 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3076,8 +3076,6 @@ fn goto_prev_diag(cx: &mut Context) { let diag = doc .shown_diagnostics() - .collect::<Vec<_>>() - .into_iter() .rev() .find(|diag| diag.range.start < cursor_pos) .or_else(|| doc.shown_diagnostics().last()); diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 734d76d1..37ddc2b6 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1607,7 +1607,7 @@ impl Document { &self.diagnostics } - pub fn shown_diagnostics(&self) -> impl Iterator<Item = &Diagnostic> { + pub fn shown_diagnostics(&self) -> impl Iterator<Item = &Diagnostic> + DoubleEndedIterator { let ls_ids: HashSet<_> = self .language_servers_with_feature(LanguageServerFeature::Diagnostics) .iter() |