@@ -126,23 +126,19 @@ impl Manifestation {
126126 }
127127
128128 // Validate that the requested components are available
129- match update. unavailable_components ( new_manifest, toolchain_str) {
130- Ok ( _) => { }
131- Err ( e) => {
132- if force_update {
133- if let Ok ( RustupError :: RequestedComponentsUnavailable { components, .. } ) =
134- e. downcast :: < RustupError > ( )
135- {
136- for component in & components {
137- notify_handler ( Notification :: ForcingUnavailableComponent (
138- component. name ( new_manifest) . as_str ( ) ,
139- ) ) ;
140- }
141- update. drop_components_to_install ( & components) ;
142- }
143- } else {
144- return Err ( e) ;
129+ if let Err ( e) = update. unavailable_components ( new_manifest, toolchain_str) {
130+ if !force_update {
131+ return Err ( e) ;
132+ }
133+ if let Ok ( RustupError :: RequestedComponentsUnavailable { components, .. } ) =
134+ e. downcast :: < RustupError > ( )
135+ {
136+ for component in & components {
137+ notify_handler ( Notification :: ForcingUnavailableComponent (
138+ & component. name ( new_manifest) ,
139+ ) ) ;
145140 }
141+ update. drop_components_to_install ( & components) ;
146142 }
147143 }
148144
@@ -667,18 +663,8 @@ impl Update {
667663 }
668664
669665 fn drop_components_to_install ( & mut self , to_drop : & [ Component ] ) {
670- let components: Vec < _ > = self
671- . components_to_install
672- . drain ( ..)
673- . filter ( |c| !to_drop. contains ( c) )
674- . collect ( ) ;
675- self . components_to_install . extend ( components) ;
676- let final_components: Vec < _ > = self
677- . final_component_list
678- . drain ( ..)
679- . filter ( |c| !to_drop. contains ( c) )
680- . collect ( ) ;
681- self . final_component_list = final_components;
666+ self . components_to_install . retain ( |c| !to_drop. contains ( c) ) ;
667+ self . final_component_list . retain ( |c| !to_drop. contains ( c) ) ;
682668 }
683669
684670 /// Map components to urls and hashes
0 commit comments