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 4a27298 commit 5a8ad81
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,12 +54,12 @@ 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.
#[expect(clippy::unnecessary_wraps)]
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 @@ -79,7 +79,7 @@ impl Config {
token_url.into()
};

Ok(Config {
Config {
filename,
process_bound: false,
cached_auth: auth,
Expand All @@ -89,7 +89,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 @@ -117,7 +117,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 5a8ad81

Please sign in to comment.