Skip to content

Commit 822151d

Browse files
committed
refactor(common): use early return in warn_if_host_is_incompatible()
1 parent 9638654 commit 822151d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/cli/common.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,12 @@ pub(crate) fn warn_if_host_is_incompatible(
642642
target_triple: &TargetTriple,
643643
force_non_host: bool,
644644
) -> Result<()> {
645-
if !force_non_host && !host_arch.can_run(target_triple)? {
646-
error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain.");
647-
warn!("toolchain '{toolchain}' may not be able to run on this system.");
648-
warn!("If you meant to build software to target that platform, perhaps try `rustup target add {target_triple}` instead?");
645+
if force_non_host || host_arch.can_run(target_triple)? {
646+
return Ok(());
649647
}
648+
error!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain.");
649+
warn!("toolchain '{toolchain}' may not be able to run on this system.");
650+
warn!("If you meant to build software to target that platform, perhaps try `rustup target add {target_triple}` instead?");
650651
Ok(())
651652
}
652653

0 commit comments

Comments
 (0)