aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/diagnostics/to_proto.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs
index 757899484..0ed87fe3e 100644
--- a/crates/rust-analyzer/src/diagnostics/to_proto.rs
+++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs
@@ -2,7 +2,7 @@
2//! `cargo check` json format to the LSP diagnostic format. 2//! `cargo check` json format to the LSP diagnostic format.
3use std::{collections::HashMap, path::Path}; 3use std::{collections::HashMap, path::Path};
4 4
5use flycheck::{Applicability, DiagnosticLevel, DiagnosticSpan}; 5use flycheck::{DiagnosticLevel, DiagnosticSpan};
6use stdx::format_to; 6use stdx::format_to;
7 7
8use crate::{lsp_ext, to_proto::url_from_abs_path}; 8use crate::{lsp_ext, to_proto::url_from_abs_path};
@@ -97,9 +97,7 @@ fn map_rust_child_diagnostic(
97 97
98 let mut edit_map: HashMap<lsp_types::Url, Vec<lsp_types::TextEdit>> = HashMap::new(); 98 let mut edit_map: HashMap<lsp_types::Url, Vec<lsp_types::TextEdit>> = HashMap::new();
99 for &span in &spans { 99 for &span in &spans {
100 if let (Some(Applicability::MachineApplicable), Some(suggested_replacement)) = 100 if let Some(suggested_replacement) = &span.suggested_replacement {
101 (&span.suggestion_applicability, &span.suggested_replacement)
102 {
103 let location = location(workspace_root, span); 101 let location = location(workspace_root, span);
104 let edit = lsp_types::TextEdit::new(location.range, suggested_replacement.clone()); 102 let edit = lsp_types::TextEdit::new(location.range, suggested_replacement.clone());
105 edit_map.entry(location.uri).or_default().push(edit); 103 edit_map.entry(location.uri).or_default().push(edit);