From a612b4e677e048c1c1849119a6eeeb34f96ca686 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Tue, 31 Aug 2021 18:44:38 +0200 Subject: [PATCH] clippy fixes --- asyncgit/src/fetch.rs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/asyncgit/src/fetch.rs b/asyncgit/src/fetch.rs index effcac1d..09269b2e 100644 --- a/asyncgit/src/fetch.rs +++ b/asyncgit/src/fetch.rs @@ -84,17 +84,22 @@ impl AsyncFetch { thread::spawn(move || { let res = Self::threaded_fetch( - sender, - arc_progress, params, - arc_res, - arc_state, + &sender, + arc_progress, + &arc_res, + &arc_state, ); if let Err(e) = res { log::error!("async fetch: {}", e); - panic!("{}", e); + Self::clear_request(&arc_state) + .expect("clear request error"); } + + sender + .send(AsyncGitNotification::Fetch) + .expect("notification error"); }); Ok(()) @@ -142,11 +147,11 @@ impl AsyncFetch { } fn threaded_fetch( - sender: Sender, - arc_progress: Arc>>, params: FetchRequest, - arc_res: Arc>>, - arc_state: Arc>>, + sender: &Sender, + arc_progress: Arc>>, + arc_res: &Arc>>, + arc_state: &Arc>>, ) -> Result<()> { let (progress_sender, receiver) = unbounded(); @@ -168,10 +173,8 @@ impl AsyncFetch { handle.join()?; - Self::set_result(&arc_res, res)?; - Self::clear_request(&arc_state)?; - - sender.send(AsyncGitNotification::Fetch)?; + Self::set_result(arc_res, res)?; + Self::clear_request(arc_state)?; Ok(()) }