mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-05 19:50:02 +00:00
More mionr optimizations (#553)
* Optimize `BinFile::preview_bin`: Use `Path::display` instead of `to_string_lossy` to avoid allocation. * Refactor: Rm useless `AsRef::as_ref` call * Optimize `GhCrateMeta::find`: Reduce fut size by converting `Url` to `String` `Url` is much larger than `String`. * Refactor `PackageInfo::resolve`: Destruct `Meta::binstall` * Optimize `resolve::load_manifest_path`: Avoid allocation Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
707b173de1
commit
66abf1b8c1
4 changed files with 28 additions and 20 deletions
|
@ -33,13 +33,14 @@ pub async fn fetch_crate_cratesio(
|
|||
debug!("Looking up crate information");
|
||||
|
||||
// Fetch online crate information
|
||||
let base_info = crates_io_api_client
|
||||
.get_crate(name.as_ref())
|
||||
.await
|
||||
.map_err(|err| BinstallError::CratesIoApi {
|
||||
crate_name: name.into(),
|
||||
err: Box::new(err),
|
||||
})?;
|
||||
let base_info =
|
||||
crates_io_api_client
|
||||
.get_crate(name)
|
||||
.await
|
||||
.map_err(|err| BinstallError::CratesIoApi {
|
||||
crate_name: name.into(),
|
||||
err: Box::new(err),
|
||||
})?;
|
||||
|
||||
// Locate matching version
|
||||
let version_iter = base_info.versions.iter().filter(|v| !v.yanked);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue