From 6e81c9a921b975be7f2efb927dab4f3cfd505ebc Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 18 Jun 2020 15:02:36 +0300 Subject: =?UTF-8?q?Flatten=20Task=20enum=20=C2=AF\=5F(=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/rust-analyzer/src/main_loop.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 740c52e21..7a81db3d9 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -243,7 +243,8 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> { #[derive(Debug)] enum Task { Respond(Response), - SendMessage(Message), + Notify(Notification), + SendRequest(Request), Diagnostic(DiagnosticTask), } @@ -275,7 +276,7 @@ impl fmt::Debug for Event { return debug_verbose_not(not, f); } } - Event::Task(Task::SendMessage(Message::Notification(not))) => { + Event::Task(Task::Notify(not)) => { if notification_is::(not) { return debug_verbose_not(not, f); } @@ -463,7 +464,7 @@ fn on_progress_report( token: lsp_types::ProgressToken::String(token.to_string()), }, ); - task_sender.send(Task::SendMessage(create_progress_req.into())).unwrap(); + task_sender.send(Task::SendRequest(create_progress_req.into())).unwrap(); }; let (token, progress) = match report { @@ -526,7 +527,7 @@ fn on_progress_report( value: lsp_types::ProgressParamsValue::WorkDone(progress), }; let not = notification_new::(params); - task_sender.send(Task::SendMessage(not.into())).unwrap() + task_sender.send(Task::Notify(not.into())).unwrap() } fn on_task( @@ -543,7 +544,8 @@ fn on_task( msg_sender.send(response.into()).unwrap(); } } - Task::SendMessage(msg) => msg_sender.send(msg).unwrap(), + Task::Notify(not) => msg_sender.send(not.into()).unwrap(), + Task::SendRequest(req) => msg_sender.send(req.into()).unwrap(), Task::Diagnostic(task) => on_diagnostic_task(task, msg_sender, state), } } -- cgit v1.2.3