diff --git a/src/app/components/cmd_not_found.rs b/src/app/components/cmd_not_found.rs index 9270f3a..493a17c 100644 --- a/src/app/components/cmd_not_found.rs +++ b/src/app/components/cmd_not_found.rs @@ -13,23 +13,20 @@ impl> + Send + Sync> async fn handle(&self) -> Self::Output { let result = self.inner.handle().await; - match &result { - Err(_) => { - if self.command.is_empty() { - eprintln!("cx: no command entered") - } else { - eprintln!( - "cx: command not found '{}'", - self.command - .split(" ") - .collect::>() - .get(0) - .unwrap_or(&"") - ) - } + if let Err(_) = &result { + if self.command.is_empty() { + eprintln!("cx: no command entered") + } else { + eprintln!( + "cx: command not found '{}'", + self.command + .split(' ') + .collect::>() + .first() + .unwrap_or(&"") + ) } - _ => (), - }; + } result } diff --git a/src/app/retry.rs b/src/app/retry.rs index 78a2dea..5a4ae27 100644 --- a/src/app/retry.rs +++ b/src/app/retry.rs @@ -76,7 +76,7 @@ impl<'a> From>>> Self { inner: WaitSec { sec: state.interval, - sleeper: state.sleeper.clone(), + sleeper: state.sleeper, }, command: state.command, interval: state.interval, diff --git a/src/app/supervise.rs b/src/app/supervise.rs index 1a89c1b..567d5c2 100644 --- a/src/app/supervise.rs +++ b/src/app/supervise.rs @@ -71,7 +71,7 @@ impl<'a> From>>> Self { inner: WaitSec { sec: state.interval, - sleeper: state.sleeper.clone(), + sleeper: state.sleeper, }, command: state.command, interval: state.interval, @@ -90,7 +90,7 @@ impl<'a> From>> command: state.command.to_owned(), inner: CmdExecutor { command: state.command.to_owned(), - executor: &*state.executor, + executor: state.executor, }, }, command: state.command, diff --git a/src/io/tokio_impl.rs b/src/io/tokio_impl.rs index 20248aa..df316b9 100644 --- a/src/io/tokio_impl.rs +++ b/src/io/tokio_impl.rs @@ -8,7 +8,7 @@ impl PipedCmdExecutor { let options = elements.drain(1..).collect::>(); - let program = match elements.get(0) { + let program = match elements.first() { Some(_) => elements.remove(0), None => String::new(), };