@@ -106,7 +106,6 @@ impl Manifestation {
106
106
changes : Changes ,
107
107
force_update : bool ,
108
108
download_cfg : & DownloadCfg < ' _ > ,
109
- notify_handler : & dyn Fn ( Notification < ' _ > ) ,
110
109
toolchain_str : & str ,
111
110
implicit_modify : bool ,
112
111
) -> Result < UpdateStatus > {
@@ -118,8 +117,13 @@ impl Manifestation {
118
117
119
118
// Create the lists of components needed for installation
120
119
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
+ ) ?;
123
127
124
128
if update. nothing_changes ( ) {
125
129
return Ok ( UpdateStatus :: Unchanged ) ;
@@ -134,9 +138,11 @@ impl Manifestation {
134
138
e. downcast :: < RustupError > ( )
135
139
{
136
140
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
+ ) ;
140
146
}
141
147
update. drop_components_to_install ( & components) ;
142
148
}
@@ -161,7 +167,7 @@ impl Manifestation {
161
167
. unwrap_or ( DEFAULT_MAX_RETRIES ) ;
162
168
163
169
for ( component, format, url, hash) in components {
164
- notify_handler ( Notification :: DownloadingComponent (
170
+ ( download_cfg . notify_handler ) ( Notification :: DownloadingComponent (
165
171
& component. short_name ( new_manifest) ,
166
172
& self . target_triple ,
167
173
component. target . as_ref ( ) ,
@@ -180,11 +186,11 @@ impl Manifestation {
180
186
Err ( e) => {
181
187
match e. downcast_ref :: < RustupError > ( ) {
182
188
Some ( RustupError :: BrokenPartialFile ) => {
183
- notify_handler ( Notification :: RetryingDownload ( & url) ) ;
189
+ ( download_cfg . notify_handler ) ( Notification :: RetryingDownload ( & url) ) ;
184
190
return OperationResult :: Retry ( OperationError ( e) ) ;
185
191
}
186
192
Some ( RustupError :: DownloadingFile { .. } ) => {
187
- notify_handler ( Notification :: RetryingDownload ( & url) ) ;
193
+ ( download_cfg . notify_handler ) ( Notification :: RetryingDownload ( & url) ) ;
188
194
return OperationResult :: Retry ( OperationError ( e) ) ;
189
195
}
190
196
Some ( _) => return OperationResult :: Err ( OperationError ( e) ) ,
@@ -202,7 +208,7 @@ impl Manifestation {
202
208
}
203
209
204
210
// 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 ) ;
206
212
207
213
// If the previous installation was from a v1 manifest we need
208
214
// to uninstall it first.
@@ -215,13 +221,18 @@ impl Manifestation {
215
221
} else {
216
222
Notification :: RemovingComponent
217
223
} ;
218
- notify_handler ( notification (
224
+ ( download_cfg . notify_handler ) ( notification (
219
225
& component. short_name ( new_manifest) ,
220
226
& self . target_triple ,
221
227
component. target . as_ref ( ) ,
222
228
) ) ;
223
229
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
+ ) ?;
225
236
}
226
237
227
238
// Install components
@@ -234,14 +245,14 @@ impl Manifestation {
234
245
let short_pkg_name = component. short_name_in_manifest ( ) ;
235
246
let short_name = component. short_name ( new_manifest) ;
236
247
237
- notify_handler ( Notification :: InstallingComponent (
248
+ ( download_cfg . notify_handler ) ( Notification :: InstallingComponent (
238
249
& short_name,
239
250
& self . target_triple ,
240
251
component. target . as_ref ( ) ,
241
252
) ) ;
242
253
243
254
let notification_converter = |notification : crate :: utils:: Notification < ' _ > | {
244
- notify_handler ( notification. into ( ) ) ;
255
+ ( download_cfg . notify_handler ) ( notification. into ( ) ) ;
245
256
} ;
246
257
let gz;
247
258
let xz;
0 commit comments