about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/dispatch.rs14
-rw-r--r--crates/rust-analyzer/src/main_loop.rs6
-rw-r--r--crates/rust-analyzer/src/task_pool.rs8
3 files changed, 9 insertions, 19 deletions
diff --git a/crates/rust-analyzer/src/dispatch.rs b/crates/rust-analyzer/src/dispatch.rs
index 8c74fcaeaf5..4d94630a564 100644
--- a/crates/rust-analyzer/src/dispatch.rs
+++ b/crates/rust-analyzer/src/dispatch.rs
@@ -51,10 +51,9 @@ impl<'a> RequestDispatcher<'a> {
             let _pctx = stdx::panic_context::enter(panic_context);
             f(self.global_state, params)
         };
-        match result_to_response::<R>(req.id.clone(), result) {
-            Ok(response) => self.global_state.respond(response),
-            Err(_) => self.global_state.task_pool.handle.send_retry(req),
-        };
+        if let Ok(response) = result_to_response::<R>(req.id.clone(), result) {
+            self.global_state.respond(response);
+        }
 
         self
     }
@@ -80,10 +79,9 @@ impl<'a> RequestDispatcher<'a> {
             f(global_state_snapshot, params)
         });
 
-        match thread_result_to_response::<R>(req.id.clone(), result) {
-            Ok(response) => self.global_state.respond(response),
-            Err(_) => self.global_state.task_pool.handle.send_retry(req),
-        };
+        if let Ok(response) = thread_result_to_response::<R>(req.id.clone(), result) {
+            self.global_state.respond(response);
+        }
 
         self
     }
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 612d1c9b704..0fc5fd9dfa5 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -173,13 +173,13 @@ impl GlobalState {
                 msg.ok().map(Event::Lsp),
 
             recv(self.task_pool.receiver) -> task =>
-                task.ok().map(Event::Task),
+                Some(Event::Task(task.unwrap())),
 
             recv(self.loader.receiver) -> task =>
-                task.ok().map(Event::Vfs),
+                Some(Event::Vfs(task.unwrap())),
 
             recv(self.flycheck_receiver) -> task =>
-                task.ok().map(Event::Flycheck),
+                Some(Event::Flycheck(task.unwrap())),
         }
     }
 
diff --git a/crates/rust-analyzer/src/task_pool.rs b/crates/rust-analyzer/src/task_pool.rs
index 2c11a5f8831..83389373903 100644
--- a/crates/rust-analyzer/src/task_pool.rs
+++ b/crates/rust-analyzer/src/task_pool.rs
@@ -2,8 +2,6 @@
 //! properly.
 use crossbeam_channel::Sender;
 
-use crate::main_loop::Task;
-
 pub(crate) struct TaskPool<T> {
     sender: Sender<T>,
     inner: threadpool::ThreadPool,
@@ -46,9 +44,3 @@ impl<T> Drop for TaskPool<T> {
         self.inner.join()
     }
 }
-
-impl TaskPool<Task> {
-    pub(crate) fn send_retry(&self, req: lsp_server::Request) {
-        let _ = self.sender.send(Task::Retry(req));
-    }
-}