Skip to content

Commit

Permalink
refactor: remove unnecessary Arc
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Nov 4, 2023
1 parent fbcca1f commit fc7d2b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/tarball/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<'a> DownloadTarballToStore<'a> {
if tarball_cache.insert(package_url.to_string(), Arc::clone(&cache_lock)).is_some() {
tracing::warn!(target: "pacquet::download", ?package_url, "Race condition detected when writing to cache");
}
let cas_paths = self.without_cache().await?;
let cas_paths = self.without_cache().await?.pipe(Arc::new);
let mut cache_write = cache_lock.write().await;
*cache_write = CacheValue::Available(Arc::clone(&cas_paths));
notify.notify_waiters();
Expand All @@ -164,7 +164,7 @@ impl<'a> DownloadTarballToStore<'a> {
}

/// Execute the subroutine, but without using cache.
pub async fn without_cache(&self) -> Result<Arc<HashMap<OsString, PathBuf>>, TarballError> {
pub async fn without_cache(&self) -> Result<HashMap<OsString, PathBuf>, TarballError> {
let &DownloadTarballToStore {
http_client,
store_dir,
Expand Down Expand Up @@ -274,7 +274,7 @@ impl<'a> DownloadTarballToStore<'a> {

tracing::info!(target: "pacquet::download", ?package_url, "Checksum verified");

let cas_paths = extract_tarball_task.await.expect("no join error")?.pipe(Arc::new);
let cas_paths = extract_tarball_task.await.expect("no join error")?;

tracing::info!(target: "pacquet::download", ?package_url, "Tarball extracted");

Check warning on line 279 in crates/tarball/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/tarball/src/lib.rs#L279

Added line #L279 was not covered by tests

Expand Down

0 comments on commit fc7d2b1

Please sign in to comment.