about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-08-09 23:59:42 +0200
committermo8it <mo8it@proton.me>2024-08-09 23:59:42 +0200
commit7341b88e6f1fd39e4650aa26530ac53b1888d9ca (patch)
treed98cf39a7f1f3296e05f85b8eaebd1b84573fdab /src
parent58c614f5b4892b946fad8222f16b01bb6fab3919 (diff)
downloadrust-7341b88e6f1fd39e4650aa26530ac53b1888d9ca.tar.gz
rust-7341b88e6f1fd39e4650aa26530ac53b1888d9ca.zip
Remove unneeded `send` method
Diffstat (limited to 'src')
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs26
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs12
-rw-r--r--src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs22
3 files changed, 28 insertions, 32 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs
index 168f9702d1c..0ea782e1dee 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs
@@ -256,7 +256,7 @@ impl FlycheckActor {
     }
 
     fn report_progress(&self, progress: Progress) {
-        self.send(FlycheckMessage::Progress { id: self.id, progress });
+        self.sender.send(FlycheckMessage::Progress { id: self.id, progress }).unwrap();
     }
 
     fn next_event(&self, inbox: &Receiver<StateChange>) -> Option<Event> {
@@ -329,7 +329,9 @@ impl FlycheckActor {
                         );
                     }
                     if self.status == FlycheckStatus::Started {
-                        self.send(FlycheckMessage::ClearDiagnostics { id: self.id });
+                        self.sender
+                            .send(FlycheckMessage::ClearDiagnostics { id: self.id })
+                            .unwrap();
                     }
                     self.report_progress(Progress::DidFinish(res));
                     self.status = FlycheckStatus::Finished;
@@ -351,13 +353,17 @@ impl FlycheckActor {
                             "diagnostic received"
                         );
                         if self.status == FlycheckStatus::Started {
-                            self.send(FlycheckMessage::ClearDiagnostics { id: self.id });
+                            self.sender
+                                .send(FlycheckMessage::ClearDiagnostics { id: self.id })
+                                .unwrap();
                         }
-                        self.send(FlycheckMessage::AddDiagnostic {
-                            id: self.id,
-                            workspace_root: self.root.clone(),
-                            diagnostic: msg,
-                        });
+                        self.sender
+                            .send(FlycheckMessage::AddDiagnostic {
+                                id: self.id,
+                                workspace_root: self.root.clone(),
+                                diagnostic: msg,
+                            })
+                            .unwrap();
                         self.status = FlycheckStatus::DiagnosticSent;
                     }
                 },
@@ -477,10 +483,6 @@ impl FlycheckActor {
         cmd.args(args);
         Some(cmd)
     }
-
-    fn send(&self, check_task: FlycheckMessage) {
-        self.sender.send(check_task).unwrap();
-    }
 }
 
 #[allow(clippy::large_enum_variant)]
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs
index bb883a9eaf5..71f48967271 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs
@@ -504,7 +504,7 @@ impl GlobalState {
         handler: ReqHandler,
     ) {
         let request = self.req_queue.outgoing.register(R::METHOD.to_owned(), params, handler);
-        self.send(request.into());
+        self.sender.send(request.into()).unwrap();
     }
 
     pub(crate) fn complete_request(&mut self, response: lsp_server::Response) {
@@ -521,7 +521,7 @@ impl GlobalState {
         params: N::Params,
     ) {
         let not = lsp_server::Notification::new(N::METHOD.to_owned(), params);
-        self.send(not.into());
+        self.sender.send(not.into()).unwrap();
     }
 
     pub(crate) fn register_request(
@@ -544,13 +544,13 @@ impl GlobalState {
 
             let duration = start.elapsed();
             tracing::debug!("handled {} - ({}) in {:0.2?}", method, response.id, duration);
-            self.send(response.into());
+            self.sender.send(response.into()).unwrap();
         }
     }
 
     pub(crate) fn cancel(&mut self, request_id: lsp_server::RequestId) {
         if let Some(response) = self.req_queue.incoming.cancel(request_id) {
-            self.send(response.into());
+            self.sender.send(response.into()).unwrap();
         }
     }
 
@@ -558,10 +558,6 @@ impl GlobalState {
         self.req_queue.incoming.is_completed(&request.id)
     }
 
-    fn send(&self, message: lsp_server::Message) {
-        self.sender.send(message).unwrap()
-    }
-
     pub(crate) fn publish_diagnostics(
         &mut self,
         uri: Url,
diff --git a/src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs b/src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs
index 7b0f67024c6..2bd4eb67135 100644
--- a/src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs
@@ -180,17 +180,19 @@ impl NotifyActor {
                                 }
                             }
                         }
-                        self.send(loader::Message::Progress {
-                            n_total,
-                            n_done: LoadingProgress::Finished,
-                            config_version,
-                            dir: None,
-                        });
+                        self.sender
+                            .send(loader::Message::Progress {
+                                n_total,
+                                n_done: LoadingProgress::Finished,
+                                config_version,
+                                dir: None,
+                            })
+                            .unwrap();
                     }
                     Message::Invalidate(path) => {
                         let contents = read(path.as_path());
                         let files = vec![(path, contents)];
-                        self.send(loader::Message::Changed { files });
+                        self.sender.send(loader::Message::Changed { files }).unwrap();
                     }
                 },
                 Event::NotifyEvent(event) => {
@@ -238,7 +240,7 @@ impl NotifyActor {
                                     Some((path, contents))
                                 })
                                 .collect();
-                            self.send(loader::Message::Changed { files });
+                            self.sender.send(loader::Message::Changed { files }).unwrap();
                         }
                     }
                 }
@@ -322,10 +324,6 @@ impl NotifyActor {
             log_notify_error(watcher.watch(path, RecursiveMode::NonRecursive));
         }
     }
-
-    fn send(&self, msg: loader::Message) {
-        self.sender.send(msg).unwrap();
-    }
 }
 
 fn read(path: &AbsPath) -> Option<Vec<u8>> {