@@ -106,7 +106,6 @@ impl Manifestation {
106106 changes : Changes ,
107107 force_update : bool ,
108108 download_cfg : & DownloadCfg < ' _ > ,
109- notify_handler : & dyn Fn ( Notification < ' _ > ) ,
110109 toolchain_str : & str ,
111110 implicit_modify : bool ,
112111 ) -> Result < UpdateStatus > {
@@ -118,8 +117,13 @@ impl Manifestation {
118117
119118 // Create the lists of components needed for installation
120119 let config = self . read_config ( ) ?;
121- let mut update =
122- Update :: build_update ( self , new_manifest, & changes, & config, notify_handler) ?;
120+ let mut update = Update :: build_update (
121+ self ,
122+ new_manifest,
123+ & changes,
124+ & config,
125+ & download_cfg. notify_handler ,
126+ ) ?;
123127
124128 if update. nothing_changes ( ) {
125129 return Ok ( UpdateStatus :: Unchanged ) ;
@@ -134,9 +138,11 @@ impl Manifestation {
134138 e. downcast :: < RustupError > ( )
135139 {
136140 for component in & components {
137- notify_handler ( Notification :: ForcingUnavailableComponent (
138- component. name ( new_manifest) . as_str ( ) ,
139- ) ) ;
141+ ( download_cfg. notify_handler ) (
142+ Notification :: ForcingUnavailableComponent (
143+ component. name ( new_manifest) . as_str ( ) ,
144+ ) ,
145+ ) ;
140146 }
141147 update. drop_components_to_install ( & components) ;
142148 }
@@ -161,7 +167,7 @@ impl Manifestation {
161167 . unwrap_or ( DEFAULT_MAX_RETRIES ) ;
162168
163169 for ( component, format, url, hash) in components {
164- notify_handler ( Notification :: DownloadingComponent (
170+ ( download_cfg . notify_handler ) ( Notification :: DownloadingComponent (
165171 & component. short_name ( new_manifest) ,
166172 & self . target_triple ,
167173 component. target . as_ref ( ) ,
@@ -180,11 +186,11 @@ impl Manifestation {
180186 Err ( e) => {
181187 match e. downcast_ref :: < RustupError > ( ) {
182188 Some ( RustupError :: BrokenPartialFile ) => {
183- notify_handler ( Notification :: RetryingDownload ( & url) ) ;
189+ ( download_cfg . notify_handler ) ( Notification :: RetryingDownload ( & url) ) ;
184190 return OperationResult :: Retry ( OperationError ( e) ) ;
185191 }
186192 Some ( RustupError :: DownloadingFile { .. } ) => {
187- notify_handler ( Notification :: RetryingDownload ( & url) ) ;
193+ ( download_cfg . notify_handler ) ( Notification :: RetryingDownload ( & url) ) ;
188194 return OperationResult :: Retry ( OperationError ( e) ) ;
189195 }
190196 Some ( _) => return OperationResult :: Err ( OperationError ( e) ) ,
@@ -202,7 +208,7 @@ impl Manifestation {
202208 }
203209
204210 // Begin transaction
205- let mut tx = Transaction :: new ( prefix. clone ( ) , temp_cfg, notify_handler) ;
211+ let mut tx = Transaction :: new ( prefix. clone ( ) , temp_cfg, download_cfg . notify_handler ) ;
206212
207213 // If the previous installation was from a v1 manifest we need
208214 // to uninstall it first.
@@ -215,13 +221,18 @@ impl Manifestation {
215221 } else {
216222 Notification :: RemovingComponent
217223 } ;
218- notify_handler ( notification (
224+ ( download_cfg . notify_handler ) ( notification (
219225 & component. short_name ( new_manifest) ,
220226 & self . target_triple ,
221227 component. target . as_ref ( ) ,
222228 ) ) ;
223229
224- tx = self . uninstall_component ( component, new_manifest, tx, & notify_handler) ?;
230+ tx = self . uninstall_component (
231+ component,
232+ new_manifest,
233+ tx,
234+ & download_cfg. notify_handler ,
235+ ) ?;
225236 }
226237
227238 // Install components
@@ -234,14 +245,14 @@ impl Manifestation {
234245 let short_pkg_name = component. short_name_in_manifest ( ) ;
235246 let short_name = component. short_name ( new_manifest) ;
236247
237- notify_handler ( Notification :: InstallingComponent (
248+ ( download_cfg . notify_handler ) ( Notification :: InstallingComponent (
238249 & short_name,
239250 & self . target_triple ,
240251 component. target . as_ref ( ) ,
241252 ) ) ;
242253
243254 let notification_converter = |notification : crate :: utils:: Notification < ' _ > | {
244- notify_handler ( notification. into ( ) ) ;
255+ ( download_cfg . notify_handler ) ( notification. into ( ) ) ;
245256 } ;
246257 let gz;
247258 let xz;
0 commit comments