From 2099316ecc735c0a871120c668267a4888173766 Mon Sep 17 00:00:00 2001 From: royalpinto007 Date: Sat, 30 Dec 2023 16:11:25 +0530 Subject: [PATCH] fix: using map instead of if let --- coffee_cmd/src/main.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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); } }