From 9e019b462ff05315641c95442faf7f8fc80f76b1 Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 21 Sep 2021 01:04:49 +0200 Subject: Slightly more consistent error handling --- src/actions/mod.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/actions/mod.rs') diff --git a/src/actions/mod.rs b/src/actions/mod.rs index 588ce8f..86af955 100644 --- a/src/actions/mod.rs +++ b/src/actions/mod.rs @@ -4,6 +4,7 @@ mod update; use std::path::{Path, PathBuf}; +use anyhow::Result; pub use create::create; pub use shift::shift; pub use update::update; @@ -19,12 +20,8 @@ impl ActionOptions { } } - pub fn from_pwd() -> Result { - let current_path = std::env::current_dir(); - if let Ok(repository_path) = current_path { - Ok(ActionOptions { repository_path }) - } else { - Err(()) - } + pub fn from_pwd() -> Result { + let repository_path = std::env::current_dir()?; + Ok(ActionOptions { repository_path }) } } -- cgit 1.4.1