Simplify download_and_extract_with_filter: Take TarBasedFmt

instead of `PkgFmt`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-11 19:30:06 +10:00
parent cbd57a1bce
commit b1b79921b2
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 5 additions and 11 deletions

View file

@ -7,7 +7,7 @@ use log::debug;
use semver::{Version, VersionReq};
use url::Url;
use crate::{helpers::*, BinstallError, PkgFmt};
use crate::{helpers::*, BinstallError, TarBasedFmt};
fn find_version<'a, V: Iterator<Item = &'a String>>(
requirement: &str,
@ -112,7 +112,7 @@ pub async fn fetch_crate_cratesio(
download_and_extract_with_filter(
Url::parse(&crate_url)?,
PkgFmt::Tgz,
TarBasedFmt::Tgz,
&temp_dir,
Some(move |path: &Path| path == cargo_toml || path == main || path.starts_with(&bin)),
)