diff --git a/src/config.rs b/src/config.rs index 129aaf07..465989ce 100644 --- a/src/config.rs +++ b/src/config.rs @@ -568,13 +568,11 @@ impl ConfigFile { to read the include directory before returning the main config path */ for include in dir_include { - let include_contents = fs::read_to_string(&include).map_err(|e| { + let include_contents = fs::read_to_string(&include).inspect_err(|_| { error!("Unable to read {}", include.display()); - e })?; - let include_contents_parsed = toml::from_str(include_contents.as_str()).map_err(|e| { + let include_contents_parsed = toml::from_str(include_contents.as_str()).inspect_err(|_| { error!("Failed to deserialize {}", include.display()); - e })?; result.merge(include_contents_parsed); @@ -589,9 +587,8 @@ impl ConfigFile { return Ok(result); } - let mut contents_non_split = fs::read_to_string(&config_path).map_err(|e| { + let mut contents_non_split = fs::read_to_string(&config_path).inspect_err(|_| { error!("Unable to read {}", config_path.display()); - e })?; Self::ensure_misc_is_present(&mut contents_non_split, &config_path); @@ -602,9 +599,8 @@ impl ConfigFile { let contents_split = regex_match_include.split_inclusive_left(contents_non_split.as_str()); for contents in contents_split { - let config_file_include_only: ConfigFileIncludeOnly = toml::from_str(contents).map_err(|e| { + let config_file_include_only: ConfigFileIncludeOnly = toml::from_str(contents).inspect_err(|_| { error!("Failed to deserialize an include section of {}", config_path.display()); - e })?; if let Some(includes) = &config_file_include_only.include { diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index fb56d96e..7853d535 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -369,7 +369,7 @@ fn upgrade_openmandriva(ctx: &ExecutionContext) -> Result<()> { let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?; let mut command = ctx.run_type().execute(sudo); - command.arg(&which("dnf").unwrap()).arg("upgrade"); + command.arg(which("dnf").unwrap()).arg("upgrade"); if let Some(args) = ctx.config().dnf_arguments() { command.args(args.split_whitespace()); @@ -388,7 +388,7 @@ fn upgrade_pclinuxos(ctx: &ExecutionContext) -> Result<()> { let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?; let mut command_update = ctx.run_type().execute(sudo); - command_update.arg(&which("apt-get").unwrap()).arg("update"); + command_update.arg(which("apt-get").unwrap()).arg("update"); if let Some(args) = ctx.config().dnf_arguments() { command_update.args(args.split_whitespace()); @@ -401,7 +401,7 @@ fn upgrade_pclinuxos(ctx: &ExecutionContext) -> Result<()> { command_update.status_checked()?; let mut cmd = ctx.run_type().execute(sudo); - cmd.arg(&which("apt-get").unwrap()); + cmd.arg(which("apt-get").unwrap()); cmd.arg("dist-upgrade"); if ctx.config().yes(Step::System) { cmd.arg("-y"); diff --git a/src/steps/zsh.rs b/src/steps/zsh.rs index 6907d645..35767e92 100644 --- a/src/steps/zsh.rs +++ b/src/steps/zsh.rs @@ -229,7 +229,7 @@ pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> { custom_repos.remove(&oh_my_zsh); ctx.run_type() .execute("zsh") - .arg(&oh_my_zsh.join("tools/upgrade.sh")) + .arg(oh_my_zsh.join("tools/upgrade.sh")) // oh-my-zsh returns 80 when it is already updated and no changes pulled // in this update. // See this comment: https://github.com/r-darwish/topgrade/issues/569#issuecomment-736756731