@@ -249,15 +249,20 @@ fn setup(ask_user: bool) {
249
249
println ! ( "Installing xargo: `cargo install xargo -f`" ) ;
250
250
}
251
251
252
- if !cargo ( ) . args ( & [ "install" , "xargo" , "-f" ] ) . status ( ) . unwrap ( ) . success ( ) {
252
+ if !cargo ( ) . args ( & [ "install" , "xargo" , "-f" ] ) . status ( )
253
+ . expect ( "failed to install xargo" )
254
+ . success ( )
255
+ {
253
256
show_error ( format ! ( "Failed to install xargo" ) ) ;
254
257
}
255
258
}
256
259
257
260
// Then, unless `XARGO_RUST_SRC` is set, we also need rust-src.
258
261
// Let's see if it is already installed.
259
262
if std:: env:: var ( "XARGO_RUST_SRC" ) . is_err ( ) {
260
- let sysroot = Command :: new ( "rustc" ) . args ( & [ "--print" , "sysroot" ] ) . output ( ) . unwrap ( ) . stdout ;
263
+ let sysroot = Command :: new ( "rustc" ) . args ( & [ "--print" , "sysroot" ] ) . output ( )
264
+ . expect ( "failed to get rustc sysroot" )
265
+ . stdout ;
261
266
let sysroot = std:: str:: from_utf8 ( & sysroot) . unwrap ( ) ;
262
267
let src = Path :: new ( sysroot. trim_end_matches ( '\n' ) ) . join ( "lib" ) . join ( "rustlib" ) . join ( "src" ) ;
263
268
if !src. exists ( ) {
@@ -266,7 +271,10 @@ fn setup(ask_user: bool) {
266
271
} else {
267
272
println ! ( "Installing rust-src component: `rustup component add rust-src`" ) ;
268
273
}
269
- if !Command :: new ( "rustup" ) . args ( & [ "component" , "add" , "rust-src" ] ) . status ( ) . unwrap ( ) . success ( ) {
274
+ if !Command :: new ( "rustup" ) . args ( & [ "component" , "add" , "rust-src" ] ) . status ( )
275
+ . expect ( "failed to install rust-src component" )
276
+ . success ( )
277
+ {
270
278
show_error ( format ! ( "Failed to install rust-src component" ) ) ;
271
279
}
272
280
}
@@ -313,7 +321,9 @@ path = "lib.rs"
313
321
if let Some ( ref target) = target {
314
322
command. arg ( "--target" ) . arg ( & target) ;
315
323
}
316
- if !command. status ( ) . unwrap ( ) . success ( )
324
+ if !command. status ( )
325
+ . expect ( "failed to run xargo" )
326
+ . success ( )
317
327
{
318
328
show_error ( format ! ( "Failed to run xargo" ) ) ;
319
329
}
0 commit comments