Skip to content

Commit

Permalink
ref(config): Remove unneeded Result from Config::from_file
Browse files Browse the repository at this point in the history
This function does not need to return a `Result`, as it can never fail.

Ref #2357
  • Loading branch information
szokeasaurusrex committed Jan 24, 2025
1 parent 4278c53 commit 96362dd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ impl Config {
/// Loads the CLI config from the default location and returns it.
pub fn from_cli_config() -> Result<Config> {
let (filename, ini) = load_cli_config()?;
Config::from_file(filename, ini)
Ok(Config::from_file(filename, ini))
}

/// Creates Config based on provided config file.
pub fn from_file(filename: PathBuf, ini: Ini) -> Result<Config> {
pub fn from_file(filename: PathBuf, ini: Ini) -> Self {
let auth = get_default_auth(&ini);
let token_embedded_data = match auth {
Some(Auth::Token(ref token)) => token.payload().cloned(),
Expand All @@ -78,7 +78,7 @@ impl Config {
token_url.into()
};

Ok(Config {
Config {
filename,
process_bound: false,
cached_auth: auth,
Expand All @@ -88,7 +88,7 @@ impl Config {
cached_vcs_remote: get_default_vcs_remote(&ini),
ini,
cached_token_data: token_embedded_data,
})
}
}

/// Makes this config the process bound one that can be
Expand Down Expand Up @@ -116,7 +116,7 @@ impl Config {
/// Return the global config reference.
pub fn global() -> Result<Config> {
let (global_filename, global_config) = load_global_config_file()?;
Config::from_file(global_filename, global_config)
Ok(Config::from_file(global_filename, global_config))
}

/// Makes a copy of the config in a closure and boxes it.
Expand Down

0 comments on commit 96362dd

Please sign in to comment.