Resolves clippy errors, please review!!! (#60)

This commit is contained in:
Thomas Schönauer
2022-10-23 11:34:30 +00:00
committed by GitHub
parent 6000124062
commit 347372ca71
19 changed files with 147 additions and 140 deletions

View File

@@ -52,7 +52,7 @@ pub fn run_cargo_update(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type()
.execute(cargo_update)
.args(&["install-update", "--git", "--all"])
.args(["install-update", "--git", "--all"])
.check_run()
}
@@ -65,7 +65,7 @@ pub fn run_flutter_upgrade(run_type: RunType) -> Result<()> {
pub fn run_go(run_type: RunType) -> Result<()> {
let go = utils::require("go")?;
let go_output = run_type.execute(&go).args(&["env", "GOPATH"]).check_output()?;
let go_output = run_type.execute(&go).args(["env", "GOPATH"]).check_output()?;
let gopath = go_output.trim();
let go_global_update = utils::require("go-global-update")
@@ -123,7 +123,7 @@ pub fn run_sheldon(ctx: &ExecutionContext) -> Result<()> {
print_separator("Sheldon");
ctx.run_type().execute(&sheldon).args(&["lock", "--update"]).check_run()
ctx.run_type().execute(&sheldon).args(["lock", "--update"]).check_run()
}
pub fn run_fossil(run_type: RunType) -> Result<()> {
@@ -131,7 +131,7 @@ pub fn run_fossil(run_type: RunType) -> Result<()> {
print_separator("Fossil");
run_type.execute(&fossil).args(&["all", "sync"]).check_run()
run_type.execute(&fossil).args(["all", "sync"]).check_run()
}
pub fn run_micro(run_type: RunType) -> Result<()> {
@@ -139,7 +139,7 @@ pub fn run_micro(run_type: RunType) -> Result<()> {
print_separator("micro");
let stdout = run_type.execute(&micro).args(&["-plugin", "update"]).string_output()?;
let stdout = run_type.execute(&micro).args(["-plugin", "update"]).string_output()?;
std::io::stdout().write_all(stdout.as_bytes())?;
if stdout.contains("Nothing to install / update") || stdout.contains("One or more plugins installed") {
@@ -160,7 +160,7 @@ pub fn run_apm(run_type: RunType) -> Result<()> {
print_separator("Atom Package Manager");
run_type.execute(&apm).args(&["upgrade", "--confirm=false"]).check_run()
run_type.execute(&apm).args(["upgrade", "--confirm=false"]).check_run()
}
pub fn run_rustup(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -169,7 +169,7 @@ pub fn run_rustup(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("rustup");
if rustup.canonicalize()?.is_descendant_of(base_dirs.home_dir()) {
run_type.execute(&rustup).args(&["self", "update"]).check_run()?;
run_type.execute(&rustup).args(["self", "update"]).check_run()?;
}
run_type.execute(&rustup).arg("update").check_run()
@@ -181,8 +181,8 @@ pub fn run_choosenim(ctx: &ExecutionContext) -> Result<()> {
print_separator("choosenim");
let run_type = ctx.run_type();
run_type.execute(&choosenim).args(&["update", "self"]).check_run()?;
run_type.execute(&choosenim).args(&["update", "stable"]).check_run()
run_type.execute(&choosenim).args(["update", "self"]).check_run()?;
run_type.execute(&choosenim).args(["update", "stable"]).check_run()
}
pub fn run_krew_upgrade(run_type: RunType) -> Result<()> {
@@ -190,7 +190,7 @@ pub fn run_krew_upgrade(run_type: RunType) -> Result<()> {
print_separator("Krew");
run_type.execute(&krew).args(&["upgrade"]).check_run()
run_type.execute(&krew).args(["upgrade"]).check_run()
}
pub fn run_gcloud_components_update(run_type: RunType) -> Result<()> {
@@ -200,7 +200,7 @@ pub fn run_gcloud_components_update(run_type: RunType) -> Result<()> {
run_type
.execute(&gcloud)
.args(&["components", "update", "--quiet"])
.args(["components", "update", "--quiet"])
.check_run()
}
@@ -209,7 +209,7 @@ pub fn run_jetpack(run_type: RunType) -> Result<()> {
print_separator("Jetpack");
run_type.execute(&jetpack).args(&["global", "update"]).check_run()
run_type.execute(&jetpack).args(["global", "update"]).check_run()
}
pub fn run_rtcl(ctx: &ExecutionContext) -> Result<()> {
@@ -239,7 +239,7 @@ pub fn run_vcpkg_update(run_type: RunType) -> Result<()> {
let vcpkg = utils::require("vcpkg")?;
print_separator("vcpkg");
run_type.execute(&vcpkg).args(&["upgrade", "--no-dry-run"]).check_run()
run_type.execute(&vcpkg).args(["upgrade", "--no-dry-run"]).check_run()
}
pub fn run_pipx_update(run_type: RunType) -> Result<()> {
@@ -253,7 +253,7 @@ pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
let conda = utils::require("conda")?;
let output = Command::new("conda")
.args(&["config", "--show", "auto_activate_base"])
.args(["config", "--show", "auto_activate_base"])
.output()?;
let string_output = String::from_utf8(output.stdout)?;
debug!("Conda output: {}", string_output);
@@ -265,14 +265,14 @@ pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type()
.execute(&conda)
.args(&["update", "--all", "-y"])
.args(["update", "--all", "-y"])
.check_run()
}
pub fn run_pip3_update(run_type: RunType) -> Result<()> {
let python3 = utils::require("python3")?;
Command::new(&python3)
.args(&["-m", "pip"])
.args(["-m", "pip"])
.check_output()
.map_err(|_| SkipStep("pip does not exists".to_string()))?;
@@ -284,7 +284,7 @@ pub fn run_pip3_update(run_type: RunType) -> Result<()> {
run_type
.execute(&python3)
.args(&["-m", "pip", "install", "--upgrade", "--user", "pip"])
.args(["-m", "pip", "install", "--upgrade", "--user", "pip"])
.check_run()
}
@@ -335,7 +335,7 @@ pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
c.arg(&tlmgr);
c
};
command.args(&["update", "--self", "--all"]);
command.args(["update", "--self", "--all"]);
command.check_run()
}
@@ -377,7 +377,7 @@ pub fn run_custom_command(name: &str, command: &str, ctx: &ExecutionContext) ->
pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
let composer = utils::require("composer")?;
let composer_home = Command::new(&composer)
.args(&["global", "config", "--absolute", "--quiet", "home"])
.args(["global", "config", "--absolute", "--quiet", "home"])
.check_output()
.map_err(|e| (SkipStep(format!("Error getting the composer directory: {}", e))))
.map(|s| PathBuf::from(s.trim()))?
@@ -415,7 +415,7 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
}
}
let output = Command::new(&composer).args(&["global", "update"]).output()?;
let output = Command::new(&composer).args(["global", "update"]).output()?;
let status = output.status;
if !status.success() {
return Err(TopgradeError::ProcessFailed(status).into());
@@ -436,7 +436,7 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> {
let dotnet = utils::require("dotnet")?;
let output = Command::new(dotnet).args(&["tool", "list", "--global"]).output()?;
let output = Command::new(dotnet).args(["tool", "list", "--global"]).output()?;
if !output.status.success() {
return Err(SkipStep(format!("dotnet failed with exit code {:?}", output.status)).into());
@@ -459,7 +459,7 @@ pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> {
let package_name = package.split_whitespace().next().unwrap();
ctx.run_type()
.execute("dotnet")
.args(&["tool", "update", package_name, "--global"])
.args(["tool", "update", package_name, "--global"])
.check_run()?;
}
@@ -471,7 +471,7 @@ pub fn run_raco_update(run_type: RunType) -> Result<()> {
print_separator("Racket Package Manager");
run_type.execute(&raco).args(&["pkg", "update", "--all"]).check_run()
run_type.execute(&raco).args(["pkg", "update", "--all"]).check_run()
}
pub fn bin_update(ctx: &ExecutionContext) -> Result<()> {
@@ -490,7 +490,7 @@ pub fn spicetify_upgrade(ctx: &ExecutionContext) -> Result<()> {
pub fn run_ghcli_extensions_upgrade(ctx: &ExecutionContext) -> Result<()> {
let gh = utils::require("gh")?;
let result = Command::new(&gh).args(&["extensions", "list"]).check_output();
let result = Command::new(&gh).args(["extensions", "list"]).check_output();
if result.is_err() {
debug!("GH result {:?}", result);
return Err(SkipStep(String::from("GH failed")).into());
@@ -499,7 +499,7 @@ pub fn run_ghcli_extensions_upgrade(ctx: &ExecutionContext) -> Result<()> {
print_separator("GitHub CLI Extensions");
ctx.run_type()
.execute(&gh)
.args(&["extension", "upgrade", "--all"])
.args(["extension", "upgrade", "--all"])
.check_run()
}
@@ -510,6 +510,6 @@ pub fn update_julia_packages(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type()
.execute(&julia)
.args(&["-e", "using Pkg; Pkg.update()"])
.args(["-e", "using Pkg; Pkg.update()"])
.check_run()
}