Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/rust-analyzer/src/flycheck.rs26
-rw-r--r--crates/rust-analyzer/src/global_state.rs12
-rw-r--r--crates/vfs-notify/src/lib.rs22
3 files changed, 28 insertions, 32 deletions
diff --git a/crates/rust-analyzer/src/flycheck.rs b/crates/rust-analyzer/src/flycheck.rs
index 168f9702d1..0ea782e1de 100644
--- a/crates/rust-analyzer/src/flycheck.rs
+++ b/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/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index bb883a9eaf..71f4896727 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/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/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs
index 7b0f67024c..2bd4eb6713 100644
--- a/crates/vfs-notify/src/lib.rs
+++ b/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>> {