cargo fmt binstalk-registry/src/lib.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2025-06-06 14:02:10 +10:00 committed by GitHub
parent 46291afd3a
commit 49f3f6a2ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -204,7 +204,9 @@ impl Registry {
pub fn url(&self) -> Result<MaybeOwned<'_, Url>, UrlParseError> { pub fn url(&self) -> Result<MaybeOwned<'_, Url>, UrlParseError> {
match self { match self {
#[cfg(feature = "git")] #[cfg(feature = "git")]
Registry::Git(registry) => Url::parse(&registry.url().to_string()).map(MaybeOwned::Owned), Registry::Git(registry) => {
Url::parse(&registry.url().to_string()).map(MaybeOwned::Owned)
}
Registry::Sparse(registry) => Ok(MaybeOwned::Borrowed(registry.url())), Registry::Sparse(registry) => Ok(MaybeOwned::Borrowed(registry.url())),
} }
} }
@ -219,8 +221,10 @@ impl Registry {
}; };
Ok(match (registry.as_str(), source_type) { Ok(match (registry.as_str(), source_type) {
("https://index.crates.io/", SourceType::Sparse) | ("https://index.crates.io/", SourceType::Sparse)
("https://github.com/rust-lang/crates.io-index", SourceType::Git) => CrateSource::cratesio_registry(), | ("https://github.com/rust-lang/crates.io-index", SourceType::Git) => {
CrateSource::cratesio_registry()
}
_ => CrateSource { _ => CrateSource {
source_type, source_type,
url: MaybeOwned::Owned(registry.into_owned()), url: MaybeOwned::Owned(registry.into_owned()),