on master help sign in
Use DoubleEndedIterator instead of collect to Vec for reversing

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>

commit0637691eb1fb7e2055fc04a0209be94906c2bd1a authorPhilipp Mildenberger <philipp@mildenberger.me> dateSat 18 Mar 2023, 17:00 (4 years ago) parentdd2f747
2 files changed+1−3
helix-term/src/commands.rs−2 helix-view/src/document.rs+1−1
helix-term/src/commands.rs−2
@@ -3076,8 +3076,6 @@ fn goto_prev_diag(cx: &mut Context) {
30763076
30773077 let diag = doc
30783078 .shown_diagnostics()
3079− .collect::<Vec<_>>()
3080− .into_iter()
30813079 .rev()
30823080 .find(|diag| diag.range.start < cursor_pos)
30833081 .or_else(|| doc.shown_diagnostics().last());
helix-view/src/document.rs+1−1
@@ -1607,7 +1607,7 @@ impl Document {
16071607 &self.diagnostics
16081608 }
16091609
1610− pub fn shown_diagnostics(&self) -> impl Iterator<Item = &Diagnostic> {
1610+ pub fn shown_diagnostics(&self) -> impl Iterator<Item = &Diagnostic> + DoubleEndedIterator {
16111611 let ls_ids: HashSet<_> = self
16121612 .language_servers_with_feature(LanguageServerFeature::Diagnostics)
16131613 .iter()