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()