From f25306ff97de8320a9ba3a1835b57f6ca00aa695 Mon Sep 17 00:00:00 2001
From: Jiahao XU <Jiahao_XU@outlook.com>
Date: Sun, 12 Jun 2022 17:07:29 +1000
Subject: [PATCH] Simplify `download_tar_based_and_visit`: Rm unused param

`path`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
---
 src/drivers/cratesio.rs |  1 -
 src/helpers.rs          | 11 +++--------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/drivers/cratesio.rs b/src/drivers/cratesio.rs
index 28a157ca..eb47a6b0 100644
--- a/src/drivers/cratesio.rs
+++ b/src/drivers/cratesio.rs
@@ -65,7 +65,6 @@ pub async fn fetch_crate_cratesio(
     download_tar_based_and_visit(
         Url::parse(&crate_url)?,
         TarBasedFmt::Tgz,
-        &temp_dir,
         ManifestVisitor::new(manifest_dir_path),
     )
     .await?
diff --git a/src/helpers.rs b/src/helpers.rs
index a4899bf9..0667383c 100644
--- a/src/helpers.rs
+++ b/src/helpers.rs
@@ -91,27 +91,22 @@ pub async fn download_and_extract<P: AsRef<Path>>(
 ///
 ///  * `filter` - If Some, then it will pass the path of the file to it
 ///    and only extract ones which filter returns `true`.
-pub async fn download_tar_based_and_visit<
-    V: TarEntriesVisitor + Debug + Send + 'static,
-    P: AsRef<Path>,
->(
+pub async fn download_tar_based_and_visit<V: TarEntriesVisitor + Debug + Send + 'static>(
     url: Url,
     fmt: TarBasedFmt,
-    path: P,
     visitor: V,
 ) -> Result<V, BinstallError> {
     debug!("Downloading from: '{url}'");
 
     let resp = create_request(url).await?;
 
-    let path = path.as_ref();
-    debug!("Downloading to file: '{}'", path.display());
+    debug!("Downloading and extracting then in-memory processing");
 
     let stream = resp.bytes_stream();
 
     let visitor = extract_tar_based_stream_and_visit(stream, fmt, visitor).await?;
 
-    debug!("Download OK, written to file: '{}'", path.display());
+    debug!("Download, extraction and in-memory procession OK");
 
     Ok(visitor)
 }