Skip to content

Commit 0af53d4

Browse files
committed
dist: yield self when download is complete
1 parent 1801205 commit 0af53d4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/dist/manifestation.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ impl Manifestation {
187187
let sem = semaphore.clone();
188188
async move {
189189
let _permit = sem.acquire().await.unwrap();
190-
bin.download(download_cfg, max_retries, new_manifest)
191-
.await
192-
.map(|downloaded| (bin, downloaded))
190+
bin.download(download_cfg, max_retries, new_manifest).await
193191
}
194192
});
195193
if components_len > 0 {
@@ -685,11 +683,11 @@ struct ComponentBinary<'a> {
685683

686684
impl<'a> ComponentBinary<'a> {
687685
async fn download(
688-
&self,
686+
self,
689687
download_cfg: &DownloadCfg<'_>,
690688
max_retries: usize,
691689
new_manifest: &Manifest,
692-
) -> Result<File> {
690+
) -> Result<(Self, File)> {
693691
use tokio_retry::{RetryIf, strategy::FixedInterval};
694692

695693
let url = download_cfg.url(&self.binary.url)?;
@@ -711,7 +709,7 @@ impl<'a> ComponentBinary<'a> {
711709
.await
712710
.with_context(|| RustupError::ComponentDownloadFailed(self.component.name(new_manifest)))?;
713711

714-
Ok(downloaded_file)
712+
Ok((self, downloaded_file))
715713
}
716714

717715
fn install<'t>(

0 commit comments

Comments
 (0)