Skip to content

Commit

Permalink
refactor: per review
Browse files Browse the repository at this point in the history
  • Loading branch information
discord9 committed Dec 12, 2024
1 parent 7ca327c commit c8612a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/toolchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
Expand Down Expand Up @@ -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();
Expand Down
17 changes: 9 additions & 8 deletions src/toolchain/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit c8612a8

Please sign in to comment.