Skip to content

Commit

Permalink
refactor(common): use early return in warn_if_host_is_incompatible()
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Aug 5, 2024
1 parent 31c8a18 commit 32e3338
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,12 @@ pub(crate) fn warn_if_host_is_incompatible(
target_triple: &TargetTriple,
force_non_host: bool,
) -> Result<()> {
if !force_non_host && !host_arch.can_run(target_triple)? {
error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain.");
warn!("toolchain '{toolchain}' may not be able to run on this system.");
warn!("If you meant to build software to target that platform, perhaps try `rustup target add {target_triple}` instead?");
if force_non_host || host_arch.can_run(target_triple)? {
return Ok(());
}
error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain.");
warn!("toolchain '{toolchain}' may not be able to run on this system.");
warn!("If you meant to build software to target that platform, perhaps try `rustup target add {target_triple}` instead?");
Ok(())
}

Expand Down

0 comments on commit 32e3338

Please sign in to comment.