Skip to content

Commit

Permalink
Merge pull request rust-lang#163 from NobodyXu/optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Jun 7, 2022
2 parents 20ec8d6 + b2a533d commit 7fa053c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/fetchers/gh_crate_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl super::Fetcher for GhCrateMeta {
}

info!("Checking for package at: '{url}'");
remote_exists(url.as_str(), Method::HEAD).await
remote_exists(url, Method::HEAD).await
}

async fn fetch(&self, dst: &Path) -> Result<(), BinstallError> {
Expand Down
2 changes: 1 addition & 1 deletion src/fetchers/quickinstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl super::Fetcher for QuickInstall {
let url = self.package_url();
self.report().await?;
info!("Checking for package at: '{url}'");
remote_exists(&url, Method::HEAD).await
remote_exists(Url::parse(&url)?, Method::HEAD).await
}

async fn fetch(&self, dst: &Path) -> Result<(), BinstallError> {
Expand Down
3 changes: 1 addition & 2 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ pub fn load_manifest_path<P: AsRef<Path>>(
Ok(manifest)
}

pub async fn remote_exists(url: &str, method: Method) -> Result<bool, BinstallError> {
let url = Url::parse(url)?;
pub async fn remote_exists(url: Url, method: Method) -> Result<bool, BinstallError> {
let req = reqwest::Client::new()
.request(method.clone(), url.clone())
.send()
Expand Down

0 comments on commit 7fa053c

Please sign in to comment.