Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7341b88

Browse files
committed
Remove unneeded send method
1 parent 58c614f commit 7341b88

File tree

3 files changed

+28
-32
lines changed

3 files changed

+28
-32
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl FlycheckActor {
256256
}
257257

258258
fn report_progress(&self, progress: Progress) {
259-
self.send(FlycheckMessage::Progress { id: self.id, progress });
259+
self.sender.send(FlycheckMessage::Progress { id: self.id, progress }).unwrap();
260260
}
261261

262262
fn next_event(&self, inbox: &Receiver<StateChange>) -> Option<Event> {
@@ -329,7 +329,9 @@ impl FlycheckActor {
329329
);
330330
}
331331
if self.status == FlycheckStatus::Started {
332-
self.send(FlycheckMessage::ClearDiagnostics { id: self.id });
332+
self.sender
333+
.send(FlycheckMessage::ClearDiagnostics { id: self.id })
334+
.unwrap();
333335
}
334336
self.report_progress(Progress::DidFinish(res));
335337
self.status = FlycheckStatus::Finished;
@@ -351,13 +353,17 @@ impl FlycheckActor {
351353
"diagnostic received"
352354
);
353355
if self.status == FlycheckStatus::Started {
354-
self.send(FlycheckMessage::ClearDiagnostics { id: self.id });
356+
self.sender
357+
.send(FlycheckMessage::ClearDiagnostics { id: self.id })
358+
.unwrap();
355359
}
356-
self.send(FlycheckMessage::AddDiagnostic {
357-
id: self.id,
358-
workspace_root: self.root.clone(),
359-
diagnostic: msg,
360-
});
360+
self.sender
361+
.send(FlycheckMessage::AddDiagnostic {
362+
id: self.id,
363+
workspace_root: self.root.clone(),
364+
diagnostic: msg,
365+
})
366+
.unwrap();
361367
self.status = FlycheckStatus::DiagnosticSent;
362368
}
363369
},
@@ -477,10 +483,6 @@ impl FlycheckActor {
477483
cmd.args(args);
478484
Some(cmd)
479485
}
480-
481-
fn send(&self, check_task: FlycheckMessage) {
482-
self.sender.send(check_task).unwrap();
483-
}
484486
}
485487

486488
#[allow(clippy::large_enum_variant)]

src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl GlobalState {
504504
handler: ReqHandler,
505505
) {
506506
let request = self.req_queue.outgoing.register(R::METHOD.to_owned(), params, handler);
507-
self.send(request.into());
507+
self.sender.send(request.into()).unwrap();
508508
}
509509

510510
pub(crate) fn complete_request(&mut self, response: lsp_server::Response) {
@@ -521,7 +521,7 @@ impl GlobalState {
521521
params: N::Params,
522522
) {
523523
let not = lsp_server::Notification::new(N::METHOD.to_owned(), params);
524-
self.send(not.into());
524+
self.sender.send(not.into()).unwrap();
525525
}
526526

527527
pub(crate) fn register_request(
@@ -544,24 +544,20 @@ impl GlobalState {
544544

545545
let duration = start.elapsed();
546546
tracing::debug!("handled {} - ({}) in {:0.2?}", method, response.id, duration);
547-
self.send(response.into());
547+
self.sender.send(response.into()).unwrap();
548548
}
549549
}
550550

551551
pub(crate) fn cancel(&mut self, request_id: lsp_server::RequestId) {
552552
if let Some(response) = self.req_queue.incoming.cancel(request_id) {
553-
self.send(response.into());
553+
self.sender.send(response.into()).unwrap();
554554
}
555555
}
556556

557557
pub(crate) fn is_completed(&self, request: &lsp_server::Request) -> bool {
558558
self.req_queue.incoming.is_completed(&request.id)
559559
}
560560

561-
fn send(&self, message: lsp_server::Message) {
562-
self.sender.send(message).unwrap()
563-
}
564-
565561
pub(crate) fn publish_diagnostics(
566562
&mut self,
567563
uri: Url,

src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,19 @@ impl NotifyActor {
180180
}
181181
}
182182
}
183-
self.send(loader::Message::Progress {
184-
n_total,
185-
n_done: LoadingProgress::Finished,
186-
config_version,
187-
dir: None,
188-
});
183+
self.sender
184+
.send(loader::Message::Progress {
185+
n_total,
186+
n_done: LoadingProgress::Finished,
187+
config_version,
188+
dir: None,
189+
})
190+
.unwrap();
189191
}
190192
Message::Invalidate(path) => {
191193
let contents = read(path.as_path());
192194
let files = vec![(path, contents)];
193-
self.send(loader::Message::Changed { files });
195+
self.sender.send(loader::Message::Changed { files }).unwrap();
194196
}
195197
},
196198
Event::NotifyEvent(event) => {
@@ -238,7 +240,7 @@ impl NotifyActor {
238240
Some((path, contents))
239241
})
240242
.collect();
241-
self.send(loader::Message::Changed { files });
243+
self.sender.send(loader::Message::Changed { files }).unwrap();
242244
}
243245
}
244246
}
@@ -322,10 +324,6 @@ impl NotifyActor {
322324
log_notify_error(watcher.watch(path, RecursiveMode::NonRecursive));
323325
}
324326
}
325-
326-
fn send(&self, msg: loader::Message) {
327-
self.sender.send(msg).unwrap();
328-
}
329327
}
330328

331329
fn read(path: &AbsPath) -> Option<Vec<u8>> {

0 commit comments

Comments
 (0)