Skip to content

Commit 47a2036

Browse files
committed
dist: yield self when download is complete
1 parent 00944c3 commit 47a2036

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
@@ -185,9 +185,7 @@ impl Manifestation {
185185
let sem = semaphore.clone();
186186
async move {
187187
let _permit = sem.acquire().await.unwrap();
188-
bin.download(download_cfg, max_retries, new_manifest)
189-
.await
190-
.map(|downloaded| (bin, downloaded))
188+
bin.download(download_cfg, max_retries, new_manifest).await
191189
}
192190
});
193191
if components_len > 0 {
@@ -683,11 +681,11 @@ struct ComponentBinary<'a> {
683681

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

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

712-
Ok(downloaded_file)
710+
Ok((self, downloaded_file))
713711
}
714712

715713
fn install<'t>(

0 commit comments

Comments
 (0)