@@ -318,7 +318,17 @@ where
318
318
319
319
pub fn list_targets ( toolchain : & Toolchain < ' _ > ) -> Result < ( ) > {
320
320
let mut t = term2:: stdout ( ) ;
321
- for component in toolchain. list_components ( ) ? {
321
+ let components = match toolchain. list_components ( ) ? {
322
+ // XXX: long term move this error to cli ? the normal .into doesn't work
323
+ // because Result here is the wrong sort and expression type ascription
324
+ // isn't a feature yet.
325
+ None => Err ( rustup:: Error (
326
+ rustup:: ErrorKind :: ComponentsUnsupported ( toolchain. name ( ) . to_string ( ) ) ,
327
+ error_chain:: State :: default ( ) ,
328
+ ) ) ,
329
+ Some ( components) => Ok ( components) ,
330
+ } ?;
331
+ for component in components {
322
332
if component. component . short_name_in_manifest ( ) == "rust-std" {
323
333
let target = component
324
334
. component
@@ -340,7 +350,17 @@ pub fn list_targets(toolchain: &Toolchain<'_>) -> Result<()> {
340
350
341
351
pub fn list_installed_targets ( toolchain : & Toolchain < ' _ > ) -> Result < ( ) > {
342
352
let mut t = term2:: stdout ( ) ;
343
- for component in toolchain. list_components ( ) ? {
353
+ let components = match toolchain. list_components ( ) ? {
354
+ // XXX: long term move this error to cli ? the normal .into doesn't work
355
+ // because Result here is the wrong sort and expression type ascription
356
+ // isn't a feature yet.
357
+ None => Err ( rustup:: Error (
358
+ rustup:: ErrorKind :: ComponentsUnsupported ( toolchain. name ( ) . to_string ( ) ) ,
359
+ error_chain:: State :: default ( ) ,
360
+ ) ) ,
361
+ Some ( components) => Ok ( components) ,
362
+ } ?;
363
+ for component in components {
344
364
if component. component . short_name_in_manifest ( ) == "rust-std" {
345
365
let target = component
346
366
. component
@@ -357,7 +377,17 @@ pub fn list_installed_targets(toolchain: &Toolchain<'_>) -> Result<()> {
357
377
358
378
pub fn list_components ( toolchain : & Toolchain < ' _ > ) -> Result < ( ) > {
359
379
let mut t = term2:: stdout ( ) ;
360
- for component in toolchain. list_components ( ) ? {
380
+ let components = match toolchain. list_components ( ) ? {
381
+ // XXX: long term move this error to cli ? the normal .into doesn't work
382
+ // because Result here is the wrong sort and expression type ascription
383
+ // isn't a feature yet.
384
+ None => Err ( rustup:: Error (
385
+ rustup:: ErrorKind :: ComponentsUnsupported ( toolchain. name ( ) . to_string ( ) ) ,
386
+ error_chain:: State :: default ( ) ,
387
+ ) ) ,
388
+ Some ( components) => Ok ( components) ,
389
+ } ?;
390
+ for component in components {
361
391
let name = component. name ;
362
392
if component. installed {
363
393
t. attr ( term2:: Attr :: Bold ) ?;
@@ -373,7 +403,17 @@ pub fn list_components(toolchain: &Toolchain<'_>) -> Result<()> {
373
403
374
404
pub fn list_installed_components ( toolchain : & Toolchain < ' _ > ) -> Result < ( ) > {
375
405
let mut t = term2:: stdout ( ) ;
376
- for component in toolchain. list_components ( ) ? {
406
+ let components = match toolchain. list_components ( ) ? {
407
+ // XXX: long term move this error to cli ? the normal .into doesn't work
408
+ // because Result here is the wrong sort and expression type ascription
409
+ // isn't a feature yet.
410
+ None => Err ( rustup:: Error (
411
+ rustup:: ErrorKind :: ComponentsUnsupported ( toolchain. name ( ) . to_string ( ) ) ,
412
+ error_chain:: State :: default ( ) ,
413
+ ) ) ,
414
+ Some ( components) => Ok ( components) ,
415
+ } ?;
416
+ for component in components {
377
417
if component. installed {
378
418
writeln ! ( t, "{}" , component. name) ?;
379
419
}
0 commit comments