mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-14 14:46:37 +00:00
Fix typing in Registry::crate_source
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
ee3af57f4d
commit
6b64129185
1 changed files with 5 additions and 5 deletions
|
@ -204,7 +204,7 @@ 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(®istry.url().to_string()).map_ok(MaybeOwned::Owned),
|
Registry::Git(registry) => Url::parse(®istry.url().to_string()).map(MaybeOwned::Owned),
|
||||||
Registry::Sparse(registry) => Ok(MaybeOwned::Borrowed(registry.url())),
|
Registry::Sparse(registry) => Ok(MaybeOwned::Borrowed(registry.url())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,14 +218,14 @@ impl Registry {
|
||||||
Registry::Sparse(_) => SourceType::Sparse,
|
Registry::Sparse(_) => SourceType::Sparse,
|
||||||
};
|
};
|
||||||
|
|
||||||
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()),
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,8 +233,8 @@ impl fmt::Display for Registry {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
Registry::Git(registry) => fmt::Display::fmt(®istry.url(), fmt),
|
Registry::Git(registry) => fmt::Display::fmt(®istry.url(), f),
|
||||||
Registry::Sparse(registry) => fmt::Display::fmt(®istry.url(), fmt),
|
Registry::Sparse(registry) => fmt::Display::fmt(®istry.url(), f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue