mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-05 11:40:04 +00:00
Merge pull request #163 from NobodyXu/optimization
This commit is contained in:
commit
7fa053cbd1
3 changed files with 3 additions and 4 deletions
|
@ -37,7 +37,7 @@ impl super::Fetcher for GhCrateMeta {
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Checking for package at: '{url}'");
|
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> {
|
async fn fetch(&self, dst: &Path) -> Result<(), BinstallError> {
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl super::Fetcher for QuickInstall {
|
||||||
let url = self.package_url();
|
let url = self.package_url();
|
||||||
self.report().await?;
|
self.report().await?;
|
||||||
info!("Checking for package at: '{url}'");
|
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> {
|
async fn fetch(&self, dst: &Path) -> Result<(), BinstallError> {
|
||||||
|
|
|
@ -32,8 +32,7 @@ pub fn load_manifest_path<P: AsRef<Path>>(
|
||||||
Ok(manifest)
|
Ok(manifest)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn remote_exists(url: &str, method: Method) -> Result<bool, BinstallError> {
|
pub async fn remote_exists(url: Url, method: Method) -> Result<bool, BinstallError> {
|
||||||
let url = Url::parse(url)?;
|
|
||||||
let req = reqwest::Client::new()
|
let req = reqwest::Client::new()
|
||||||
.request(method.clone(), url.clone())
|
.request(method.clone(), url.clone())
|
||||||
.send()
|
.send()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue