refactor: remove unnecessary cfg-if dependency (#1509)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -2918,7 +2918,6 @@ name = "topgrade"
|
|||||||
version = "16.2.1"
|
version = "16.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64ct",
|
"base64ct",
|
||||||
"cfg-if",
|
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ glob = "~0.3"
|
|||||||
strum = { version = "~0.26", features = ["derive"] }
|
strum = { version = "~0.26", features = ["derive"] }
|
||||||
thiserror = "~1.0"
|
thiserror = "~1.0"
|
||||||
tempfile = "~3.10"
|
tempfile = "~3.10"
|
||||||
cfg-if = "~1.0"
|
|
||||||
tokio = { version = "~1.47", features = ["process", "rt-multi-thread"] }
|
tokio = { version = "~1.47", features = ["process", "rt-multi-thread"] }
|
||||||
futures = "~0.3"
|
futures = "~0.3"
|
||||||
regex = "~1.10"
|
regex = "~1.10"
|
||||||
|
|||||||
@@ -889,12 +889,11 @@ pub fn run_tldr(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
|
pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
|
||||||
cfg_if::cfg_if! {
|
if cfg!(any(target_os = "linux", target_os = "android")) && !ctx.config().enable_tlmgr_linux() {
|
||||||
if #[cfg(any(target_os = "linux", target_os = "android"))] {
|
return Err(SkipStep(String::from(
|
||||||
if !ctx.config().enable_tlmgr_linux() {
|
"tlmgr must be explicitly enabled in the configuration to run in Android/Linux",
|
||||||
return Err(SkipStep(String::from("tlmgr must be explicitly enabled in the configuration to run in Android/Linux")).into());
|
))
|
||||||
}
|
.into());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let tlmgr = require("tlmgr")?;
|
let tlmgr = require("tlmgr")?;
|
||||||
@@ -999,25 +998,21 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
print_separator(t!("Composer"));
|
print_separator(t!("Composer"));
|
||||||
|
|
||||||
if ctx.config().composer_self_update() {
|
if ctx.config().composer_self_update() {
|
||||||
cfg_if::cfg_if! {
|
if cfg!(unix) {
|
||||||
if #[cfg(unix)] {
|
|
||||||
// If self-update fails without sudo then there's probably an update
|
// If self-update fails without sudo then there's probably an update
|
||||||
let has_update = match ctx.execute(&composer).arg("self-update").output()? {
|
let has_update = match ctx.execute(&composer).arg("self-update").output()? {
|
||||||
ExecutorOutput::Wet(output) => !output.status.success(),
|
ExecutorOutput::Wet(output) => !output.status.success(),
|
||||||
_ => false
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if has_update {
|
if has_update {
|
||||||
let sudo = ctx.require_sudo()?;
|
let sudo = ctx.require_sudo()?;
|
||||||
sudo.execute(ctx, &composer)?
|
sudo.execute(ctx, &composer)?.arg("self-update").status_checked()?;
|
||||||
.arg("self-update")
|
|
||||||
.status_checked()?;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ctx.execute(&composer).arg("self-update").status_checked()?;
|
ctx.execute(&composer).arg("self-update").status_checked()?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let output = ctx.execute(&composer).args(["global", "update"]).output()?;
|
let output = ctx.execute(&composer).args(["global", "update"]).output()?;
|
||||||
if let ExecutorOutput::Wet(output) = output {
|
if let ExecutorOutput::Wet(output) = output {
|
||||||
|
|||||||
Reference in New Issue
Block a user