From 2fc36fca8c8e3c528d9c45e3280ed4d856bea8bd Mon Sep 17 00:00:00 2001 From: shikhar Date: Wed, 6 Nov 2024 20:54:49 -0500 Subject: [PATCH] s --- src/config.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index ac37df5..7afe035 100644 --- a/src/config.rs +++ b/src/config.rs @@ -32,7 +32,7 @@ pub fn config_path() -> Result { pub fn load_config(path: &Path) -> Result { Config::builder() .add_source(config::File::new( - path.to_str().ok_or(S2ConfigError::PathError)?, + path.to_str().expect("config path is valid utf8"), FileFormat::Toml, )) .add_source(config::Environment::with_prefix("S2")) @@ -57,12 +57,9 @@ pub fn create_config(config_path: &PathBuf, auth_token: String) -> Result<(), S2 #[derive(Error, Debug, Diagnostic)] pub enum S2ConfigError { - #[error("Failed to find config directory")] + #[error("Failed to find a home for config directory")] DirNotFound, - #[error("Failed to find config file")] - PathError, - #[error("Failed to load config file")] #[diagnostic(help( "Did you run `s2-cli config set`? or use `S2_AUTH_TOKEN` environment variable."