diff --git a/coffee_cmd/src/main.rs b/coffee_cmd/src/main.rs index 4e8e3e6..8b9d153 100644 --- a/coffee_cmd/src/main.rs +++ b/coffee_cmd/src/main.rs @@ -65,9 +65,7 @@ async fn main() -> Result<(), CoffeeError> { }; match coffee.upgrade(&repo, verbose).await { Ok(res) => { - if let Some(spinner) = spinner { - spinner.finish(); - } + spinner.map(|s| s.finish()); match res.status { UpgradeStatus::UpToDate => { term::info!("Remote repository `{}` is already up to date!", res.repo) @@ -81,9 +79,7 @@ async fn main() -> Result<(), CoffeeError> { } } Err(err) => { - if let Some(spinner) = spinner { - spinner.failed(); - } + spinner.and_then(|spinner| spinner.failed()); return Err(err); } }