Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #20434 from ShoyuVanilla/diag-fix-again
fix: Panic while trying to clear old diagnostics while there's nothing
Shoyu Vanilla (Flint) 9 months ago
parent 7b65a45 · parent 8af9607 · commit 9db0550
-rw-r--r--crates/rust-analyzer/src/diagnostics.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/diagnostics.rs b/crates/rust-analyzer/src/diagnostics.rs
index 2711bdba69..30f530100f 100644
--- a/crates/rust-analyzer/src/diagnostics.rs
+++ b/crates/rust-analyzer/src/diagnostics.rs
@@ -105,7 +105,7 @@ impl DiagnosticCollection {
flycheck_id: usize,
generation: DiagnosticsGeneration,
) {
- if self.check[flycheck_id].generation < generation {
+ if self.check.get(flycheck_id).is_some_and(|it| it.generation < generation) {
self.clear_check(flycheck_id);
}
}