@@ -140,32 +140,19 @@ impl<'a> InstallOpts<'a> {
140
140
fn validate ( & self ) -> Result < ( ) > {
141
141
common:: warn_if_host_is_emulated ( ) ;
142
142
143
- // Verify that the installation options are vaguely sane
144
- ( || {
145
- let host_triple = self
146
- . default_host_triple
147
- . as_ref ( )
148
- . map ( dist:: TargetTriple :: new)
149
- . unwrap_or_else ( TargetTriple :: from_host_or_build) ;
150
- let partial_channel = match & self . default_toolchain {
151
- None | Some ( MaybeOfficialToolchainName :: None ) => {
152
- ResolvableToolchainName :: try_from ( "stable" ) ?
153
- }
154
- Some ( MaybeOfficialToolchainName :: Some ( s) ) => s. into ( ) ,
155
- } ;
156
- let resolved = partial_channel. resolve ( & host_triple) ?;
157
- debug ! ( "Successfully resolved installation toolchain as: {resolved}" ) ;
158
- Ok ( ( ) )
159
- } ) ( )
160
- . map_err ( |e : Box < dyn std:: error:: Error > | {
161
- anyhow ! (
162
- "Pre-checks for host and toolchain failed: {}\n \
163
- If you are unsure of suitable values, the 'stable' toolchain is the default.\n \
164
- Valid host triples look something like: {}",
165
- e,
166
- TargetTriple :: from_host_or_build( )
167
- )
168
- } ) ?;
143
+ let host_triple = self
144
+ . default_host_triple
145
+ . as_ref ( )
146
+ . map ( dist:: TargetTriple :: new)
147
+ . unwrap_or_else ( TargetTriple :: from_host_or_build) ;
148
+ let partial_channel = match & self . default_toolchain {
149
+ None | Some ( MaybeOfficialToolchainName :: None ) => {
150
+ ResolvableToolchainName :: try_from ( "stable" ) ?
151
+ }
152
+ Some ( MaybeOfficialToolchainName :: Some ( s) ) => s. into ( ) ,
153
+ } ;
154
+ let resolved = partial_channel. resolve ( & host_triple) ?;
155
+ debug ! ( "Successfully resolved installation toolchain as: {resolved}" ) ;
169
156
Ok ( ( ) )
170
157
}
171
158
}
@@ -456,7 +443,14 @@ pub(crate) async fn install(
456
443
do_pre_install_sanity_checks ( no_prompt) ?;
457
444
}
458
445
459
- opts. validate ( ) ?;
446
+ opts. validate ( ) . map_err ( |e| {
447
+ anyhow ! (
448
+ "Pre-checks for host and toolchain failed: {e}\n \
449
+ If you are unsure of suitable values, the 'stable' toolchain is the default.\n \
450
+ Valid host triples look something like: {}",
451
+ TargetTriple :: from_host_or_build( )
452
+ )
453
+ } ) ?;
460
454
461
455
if !process ( )
462
456
. var_os ( "RUSTUP_INIT_SKIP_EXISTENCE_CHECKS" )
0 commit comments