Fix nightly clippy warnings (#872)
This commit is contained in:
committed by
GitHub
parent
f3b6530969
commit
fdf40dbf43
@@ -568,13 +568,11 @@ impl ConfigFile {
|
|||||||
to read the include directory before returning the main config path
|
to read the include directory before returning the main config path
|
||||||
*/
|
*/
|
||||||
for include in dir_include {
|
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());
|
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());
|
error!("Failed to deserialize {}", include.display());
|
||||||
e
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
result.merge(include_contents_parsed);
|
result.merge(include_contents_parsed);
|
||||||
@@ -589,9 +587,8 @@ impl ConfigFile {
|
|||||||
return Ok(result);
|
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());
|
error!("Unable to read {}", config_path.display());
|
||||||
e
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Self::ensure_misc_is_present(&mut contents_non_split, &config_path);
|
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());
|
let contents_split = regex_match_include.split_inclusive_left(contents_non_split.as_str());
|
||||||
|
|
||||||
for contents in contents_split {
|
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());
|
error!("Failed to deserialize an include section of {}", config_path.display());
|
||||||
e
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if let Some(includes) = &config_file_include_only.include {
|
if let Some(includes) = &config_file_include_only.include {
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ fn upgrade_openmandriva(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
||||||
let mut command = ctx.run_type().execute(sudo);
|
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() {
|
if let Some(args) = ctx.config().dnf_arguments() {
|
||||||
command.args(args.split_whitespace());
|
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 sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
||||||
let mut command_update = ctx.run_type().execute(sudo);
|
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() {
|
if let Some(args) = ctx.config().dnf_arguments() {
|
||||||
command_update.args(args.split_whitespace());
|
command_update.args(args.split_whitespace());
|
||||||
@@ -401,7 +401,7 @@ fn upgrade_pclinuxos(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
command_update.status_checked()?;
|
command_update.status_checked()?;
|
||||||
|
|
||||||
let mut cmd = ctx.run_type().execute(sudo);
|
let mut cmd = ctx.run_type().execute(sudo);
|
||||||
cmd.arg(&which("apt-get").unwrap());
|
cmd.arg(which("apt-get").unwrap());
|
||||||
cmd.arg("dist-upgrade");
|
cmd.arg("dist-upgrade");
|
||||||
if ctx.config().yes(Step::System) {
|
if ctx.config().yes(Step::System) {
|
||||||
cmd.arg("-y");
|
cmd.arg("-y");
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
custom_repos.remove(&oh_my_zsh);
|
custom_repos.remove(&oh_my_zsh);
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute("zsh")
|
.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
|
// oh-my-zsh returns 80 when it is already updated and no changes pulled
|
||||||
// in this update.
|
// in this update.
|
||||||
// See this comment: https://github.com/r-darwish/topgrade/issues/569#issuecomment-736756731
|
// See this comment: https://github.com/r-darwish/topgrade/issues/569#issuecomment-736756731
|
||||||
|
|||||||
Reference in New Issue
Block a user