Simplify download_tar_based_and_visit: Rm unused param

`path`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-12 17:07:29 +10:00
parent e376b71cf4
commit f25306ff97
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 3 additions and 9 deletions

View file

@ -65,7 +65,6 @@ pub async fn fetch_crate_cratesio(
download_tar_based_and_visit( download_tar_based_and_visit(
Url::parse(&crate_url)?, Url::parse(&crate_url)?,
TarBasedFmt::Tgz, TarBasedFmt::Tgz,
&temp_dir,
ManifestVisitor::new(manifest_dir_path), ManifestVisitor::new(manifest_dir_path),
) )
.await? .await?

View file

@ -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 /// * `filter` - If Some, then it will pass the path of the file to it
/// and only extract ones which filter returns `true`. /// and only extract ones which filter returns `true`.
pub async fn download_tar_based_and_visit< pub async fn download_tar_based_and_visit<V: TarEntriesVisitor + Debug + Send + 'static>(
V: TarEntriesVisitor + Debug + Send + 'static,
P: AsRef<Path>,
>(
url: Url, url: Url,
fmt: TarBasedFmt, fmt: TarBasedFmt,
path: P,
visitor: V, visitor: V,
) -> Result<V, BinstallError> { ) -> Result<V, BinstallError> {
debug!("Downloading from: '{url}'"); debug!("Downloading from: '{url}'");
let resp = create_request(url).await?; let resp = create_request(url).await?;
let path = path.as_ref(); debug!("Downloading and extracting then in-memory processing");
debug!("Downloading to file: '{}'", path.display());
let stream = resp.bytes_stream(); let stream = resp.bytes_stream();
let visitor = extract_tar_based_stream_and_visit(stream, fmt, visitor).await?; 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) Ok(visitor)
} }