Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/rust-analyzer/src/diagnostics.rs8
-rw-r--r--crates/rust-analyzer/src/diagnostics/to_proto.rs8
-rw-r--r--crates/rust-analyzer/src/flycheck.rs1
3 files changed, 10 insertions, 7 deletions
diff --git a/crates/rust-analyzer/src/diagnostics.rs b/crates/rust-analyzer/src/diagnostics.rs
index 034c49c3d5..5f2871ac99 100644
--- a/crates/rust-analyzer/src/diagnostics.rs
+++ b/crates/rust-analyzer/src/diagnostics.rs
@@ -75,7 +75,7 @@ impl DiagnosticCollection {
flycheck_id: usize,
file_id: FileId,
diagnostic: lsp_types::Diagnostic,
- fix: Option<Fix>,
+ fix: Option<Box<Fix>>,
) {
let diagnostics = self.check.entry(flycheck_id).or_default().entry(file_id).or_default();
for existing_diagnostic in diagnostics.iter() {
@@ -84,8 +84,10 @@ impl DiagnosticCollection {
}
}
- let check_fixes = Arc::make_mut(&mut self.check_fixes);
- check_fixes.entry(flycheck_id).or_default().entry(file_id).or_default().extend(fix);
+ if let Some(fix) = fix {
+ let check_fixes = Arc::make_mut(&mut self.check_fixes);
+ check_fixes.entry(flycheck_id).or_default().entry(file_id).or_default().push(*fix);
+ }
diagnostics.push(diagnostic);
self.changes.insert(file_id);
}
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs
index 208a70bc02..e330cfc3cf 100644
--- a/crates/rust-analyzer/src/diagnostics/to_proto.rs
+++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs
@@ -170,7 +170,7 @@ fn resolve_path(
struct SubDiagnostic {
related: lsp_types::DiagnosticRelatedInformation,
- suggested_fix: Option<Fix>,
+ suggested_fix: Option<Box<Fix>>,
}
enum MappedRustChildDiagnostic {
@@ -241,7 +241,7 @@ fn map_rust_child_diagnostic(
location: location(config, workspace_root, spans[0], snap),
message: message.clone(),
},
- suggested_fix: Some(Fix {
+ suggested_fix: Some(Box::new(Fix {
ranges: spans
.iter()
.map(|&span| location(config, workspace_root, span, snap).range)
@@ -260,7 +260,7 @@ fn map_rust_child_diagnostic(
data: None,
command: None,
},
- }),
+ })),
})
}
}
@@ -269,7 +269,7 @@ fn map_rust_child_diagnostic(
pub(crate) struct MappedRustDiagnostic {
pub(crate) url: lsp_types::Url,
pub(crate) diagnostic: lsp_types::Diagnostic,
- pub(crate) fix: Option<Fix>,
+ pub(crate) fix: Option<Box<Fix>>,
}
/// Converts a Rust root diagnostic to LSP form
diff --git a/crates/rust-analyzer/src/flycheck.rs b/crates/rust-analyzer/src/flycheck.rs
index 8f2e7d1ca2..443f52c6dd 100644
--- a/crates/rust-analyzer/src/flycheck.rs
+++ b/crates/rust-analyzer/src/flycheck.rs
@@ -218,6 +218,7 @@ struct FlycheckActor {
status: FlycheckStatus,
}
+#[allow(clippy::large_enum_variant)]
enum Event {
RequestStateChange(StateChange),
CheckEvent(Option<CargoCheckMessage>),