From c8612a8dc344f7c9b90fdbf4d9ddf611b3fa9af0 Mon Sep 17 00:00:00 2001 From: discord9 Date: Thu, 12 Dec 2024 19:59:17 +0800 Subject: [PATCH] refactor: per review --- src/toolchain/mod.rs | 4 +--- src/toolchain/rust.rs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/toolchain/mod.rs b/src/toolchain/mod.rs index 5a76af5e..69652007 100644 --- a/src/toolchain/mod.rs +++ b/src/toolchain/mod.rs @@ -117,7 +117,6 @@ pub async fn download_file( create_dir_all(output_directory) .map_err(|_| Error::CreateDirectory(output_directory.to_string()))?; } - info!("Downloading '{}'", &file_name); let resp = { let client = build_proxy_async_client()?; @@ -151,8 +150,7 @@ pub async fn download_file( bytes.extend(&chunk); } bar.finish_with_message(format!("{} download complete", file_name)); - // remove process bar on complete - PROCESS_BARS.remove(&bar); + // leave the progress bar after completion if DOWNLOAD_CNT.fetch_sub(1, atomic::Ordering::Relaxed) == 1 { // clear all progress bars PROCESS_BARS.clear().unwrap(); diff --git a/src/toolchain/rust.rs b/src/toolchain/rust.rs index ca801369..d6110f0f 100644 --- a/src/toolchain/rust.rs +++ b/src/toolchain/rust.rs @@ -232,6 +232,15 @@ impl Installable for XtensaRust { } let tmp_dir = tempdir_in(path)?; let tmp_dir_path = &tmp_dir.path().display().to_string(); + + download_file( + self.src_dist_url.clone(), + "rust-src.tar.xz", + tmp_dir_path, + true, + false, + ) + .await?; download_file( self.dist_url.clone(), @@ -266,14 +275,6 @@ impl Installable for XtensaRust { return Err(Error::XtensaRust); } - download_file( - self.src_dist_url.clone(), - "rust-src.tar.xz", - tmp_dir_path, - true, - false, - ) - .await?; info!("Installing 'rust-src' component for Xtensa Rust toolchain"); if !Command::new("/usr/bin/env") .arg("bash")