Skip to content

Commit

Permalink
Fix nightly clippy warnings (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
PolpOnline authored Jul 21, 2024
1 parent f3b6530 commit fdf40db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
12 changes: 4 additions & 8 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/steps/os/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/steps/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fdf40db

Please sign in to comment.