Refactor: Impl Source::cratesio_registry

Makes initializing `metafiles::CrateVersionSource` more readable and
improves performance since the parsing is now cached.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-20 16:48:34 +10:00
parent 3961dbb84a
commit 5bdffd9178
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 11 additions and 3 deletions

View file

@ -650,9 +650,7 @@ async fn install_from_package(
let cvs = metafiles::CrateVersionSource {
name: name.clone(),
version: package.version.parse().into_diagnostic()?,
source: metafiles::Source::Registry(
url::Url::parse("https://github.com/rust-lang/crates.io-index").unwrap(),
),
source: metafiles::Source::cratesio_registry(),
};
info!("Installing binaries...");