From f7c4716dbfd77e94af774b4531213519821faba6 Mon Sep 17 00:00:00 2001 From: mo8it Date: Mon, 12 Aug 2024 10:55:04 +0200 Subject: [PATCH] Use the send method --- .../crates/vfs-notify/src/lib.rs | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) 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 cc10793ba47..fa2b6669664 100644 --- a/src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs +++ b/src/tools/rust-analyzer/crates/vfs-notify/src/lib.rs @@ -119,14 +119,12 @@ fn run(mut self, inbox: Receiver) { self.watched_dir_entries.clear(); self.watched_file_entries.clear(); - self.sender - .send(loader::Message::Progress { - n_total, - n_done: LoadingProgress::Started, - config_version, - dir: None, - }) - .unwrap(); + self.send(loader::Message::Progress { + n_total, + n_done: LoadingProgress::Started, + config_version, + dir: None, + }); let (entry_tx, entry_rx) = unbounded(); let (watch_tx, watch_rx) = unbounded(); @@ -142,31 +140,25 @@ fn run(mut self, inbox: Receiver) { entry, do_watch, |file| { - self.sender - .send(loader::Message::Progress { - n_total, - n_done: LoadingProgress::Progress( - processed - .load(std::sync::atomic::Ordering::Relaxed), - ), - dir: Some(file), - config_version, - }) - .unwrap() + self.send(loader::Message::Progress { + n_total, + n_done: LoadingProgress::Progress( + processed.load(std::sync::atomic::Ordering::Relaxed), + ), + dir: Some(file), + config_version, + }); }, ); - self.sender.send(loader::Message::Loaded { files }).unwrap(); - self.sender - .send(loader::Message::Progress { - n_total, - n_done: LoadingProgress::Progress( - processed.fetch_add(1, std::sync::atomic::Ordering::AcqRel) - + 1, - ), - config_version, - dir: None, - }) - .unwrap(); + self.send(loader::Message::Loaded { files }); + self.send(loader::Message::Progress { + n_total, + n_done: LoadingProgress::Progress( + processed.fetch_add(1, std::sync::atomic::Ordering::AcqRel) + 1, + ), + config_version, + dir: None, + }); }); drop(watch_tx);