Unnamed repository; edit this file 'description' to name the repository.
Enable debug printing on more types
Wilfred Hughes 2 months ago
parent ded03a0 · commit 3f65590
-rw-r--r--crates/rust-analyzer/src/flycheck.rs4
-rw-r--r--crates/rust-analyzer/tests/slow-tests/support.rs42
2 files changed, 25 insertions, 21 deletions
diff --git a/crates/rust-analyzer/src/flycheck.rs b/crates/rust-analyzer/src/flycheck.rs
index 47f7a57f72..f7f861a99e 100644
--- a/crates/rust-analyzer/src/flycheck.rs
+++ b/crates/rust-analyzer/src/flycheck.rs
@@ -382,6 +382,7 @@ enum FlycheckCommandOrigin {
ProjectJsonRunnable,
}
+#[derive(Debug)]
enum StateChange {
Restart {
generation: DiagnosticsGeneration,
@@ -435,6 +436,7 @@ enum DiagnosticsReceived {
}
#[allow(clippy::large_enum_variant)]
+#[derive(Debug)]
enum Event {
RequestStateChange(StateChange),
CheckEvent(Option<CheckMessage>),
@@ -445,6 +447,7 @@ const SAVED_FILE_PLACEHOLDER_DOLLAR: &str = "$saved_file";
const LABEL_INLINE: &str = "{label}";
const SAVED_FILE_INLINE: &str = "{saved_file}";
+#[derive(Debug)]
struct Substitutions<'a> {
label: Option<&'a str>,
saved_file: Option<&'a str>,
@@ -950,6 +953,7 @@ impl FlycheckActor {
}
#[allow(clippy::large_enum_variant)]
+#[derive(Debug)]
enum CheckMessage {
/// A message from `cargo check`, including details like the path
/// to the relevant `Cargo.toml`.
diff --git a/crates/rust-analyzer/tests/slow-tests/support.rs b/crates/rust-analyzer/tests/slow-tests/support.rs
index b8592c57de..7ee31f3d53 100644
--- a/crates/rust-analyzer/tests/slow-tests/support.rs
+++ b/crates/rust-analyzer/tests/slow-tests/support.rs
@@ -411,13 +411,13 @@ impl Server {
}
pub(crate) fn wait_for_diagnostics(&self) -> PublishDiagnosticsParams {
for msg in self.messages.borrow().iter() {
- if let Message::Notification(n) = msg {
- if n.method == "textDocument/publishDiagnostics" {
- let params: PublishDiagnosticsParams =
- serde_json::from_value(n.params.clone()).unwrap();
- if !params.diagnostics.is_empty() {
- return params;
- }
+ if let Message::Notification(n) = msg
+ && n.method == "textDocument/publishDiagnostics"
+ {
+ let params: PublishDiagnosticsParams =
+ serde_json::from_value(n.params.clone()).unwrap();
+ if !params.diagnostics.is_empty() {
+ return params;
}
}
}
@@ -426,13 +426,13 @@ impl Server {
.recv()
.unwrap_or_else(|Timeout| panic!("timeout while waiting for diagnostics"))
.expect("connection closed while waiting for diagnostics");
- if let Message::Notification(n) = &msg {
- if n.method == "textDocument/publishDiagnostics" {
- let params: PublishDiagnosticsParams =
- serde_json::from_value(n.params.clone()).unwrap();
- if !params.diagnostics.is_empty() {
- return params;
- }
+ if let Message::Notification(n) = &msg
+ && n.method == "textDocument/publishDiagnostics"
+ {
+ let params: PublishDiagnosticsParams =
+ serde_json::from_value(n.params.clone()).unwrap();
+ if !params.diagnostics.is_empty() {
+ return params;
}
}
}
@@ -444,13 +444,13 @@ impl Server {
.recv()
.unwrap_or_else(|Timeout| panic!("timeout while waiting for diagnostics to clear"))
.expect("connection closed while waiting for diagnostics to clear");
- if let Message::Notification(n) = &msg {
- if n.method == "textDocument/publishDiagnostics" {
- let params: PublishDiagnosticsParams =
- serde_json::from_value(n.params.clone()).unwrap();
- if params.diagnostics.is_empty() {
- return;
- }
+ if let Message::Notification(n) = &msg
+ && n.method == "textDocument/publishDiagnostics"
+ {
+ let params: PublishDiagnosticsParams =
+ serde_json::from_value(n.params.clone()).unwrap();
+ if params.diagnostics.is_empty() {
+ return;
}
}
}