From 035bcbe6887f22f32c95243b30906f33f907de93 Mon Sep 17 00:00:00 2001 From: Mackiovello Date: Thu, 5 Jul 2018 18:58:18 +0200 Subject: [PATCH] Simplify match expression --- src/command/pack.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/command/pack.rs b/src/command/pack.rs index a945819..b2dae6c 100644 --- a/src/command/pack.rs +++ b/src/command/pack.rs @@ -10,14 +10,12 @@ pub fn pack(path: Option, log: &Logger) -> result::Result<(), Error> { info!(&log, "Packing up the npm package..."); match npm::npm_pack(&crate_path) { - Ok(r) => r, - Err(Error::Io { .. }) => { - return Err(Error::DirNotFound { - message: "Unable to find the pkg directory".to_owned(), - }); - } - Err(e) => return Err(e), - }; + Ok(r) => Ok(r), + Err(Error::Io { .. }) => Err(Error::DirNotFound { + message: "Unable to find the pkg directory".to_owned(), + }), + Err(e) => Err(e), + }?; #[cfg(not(target_os = "windows"))] info!(&log, "Your package is located at {}/pkg", &crate_path); #[cfg(target_os = "windows")]