From 7d4020f1300f076341627785c53dd151fc7d1a61 Mon Sep 17 00:00:00 2001 From: Andreas Fuchs Date: Sun, 13 Dec 2020 23:29:21 -0500 Subject: Simplify the types involved a little The cursed match is still cursed, but at least we're not sending useless data across channels anymore. --- src/activate.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/activate.rs') diff --git a/src/activate.rs b/src/activate.rs index 00b637d..84d4b12 100644 --- a/src/activate.rs +++ b/src/activate.rs @@ -161,7 +161,7 @@ pub enum ActivationConfirmationError { CreateWatcherError(notify::Error), #[error("Error forking process: {0}")] ForkError(i32), - #[error("Could not watch for activation sentinel")] + #[error("Could not watch for activation sentinel: {0}")] WatcherError(#[from] notify::Error), } @@ -176,13 +176,13 @@ pub enum DangerZoneError { } async fn danger_zone( - mut events: mpsc::Receiver>, + mut events: mpsc::Receiver>, confirm_timeout: u16, ) -> Result<(), DangerZoneError> { info!("Waiting for confirmation event..."); match timeout(Duration::from_secs(confirm_timeout as u64), events.recv()).await { - Ok(Some(Ok(_))) => Ok(()), + Ok(Some(Ok(()))) => Ok(()), Ok(Some(Err(e))) => Err(DangerZoneError::WatchError(e)), Ok(None) => Err(DangerZoneError::NoConfirmation), Err(_) => Err(DangerZoneError::TimesUp), @@ -213,7 +213,7 @@ pub async fn activation_confirmation( Watcher::new_immediate(move |res: Result| { let send_result = match res { Ok(e) if e.kind == notify::EventKind::Remove(notify::event::RemoveKind::File) => { - deleted.blocking_send(Ok(e)) + deleted.blocking_send(Ok(())) } Ok(_) => Ok(()), // ignore non-removal events Err(e) => deleted.blocking_send(Err(e)), -- cgit v1.2.3