mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 05:28:42 +00:00
Fix loading .cargo/config.toml
(#1217)
Fixed #1216 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
07bc44e059
commit
47f79a9660
2 changed files with 4 additions and 4 deletions
|
@ -148,7 +148,7 @@ pub fn install_crates(
|
|||
index
|
||||
} else if let Some(registry_name) = args
|
||||
.registry
|
||||
.or_else(|| config.registry.map(|registry| registry.default))
|
||||
.or_else(|| config.registry.and_then(|registry| registry.default))
|
||||
{
|
||||
env::var(format!("CARGO_REGISTRIES_{registry_name}_INDEX"))
|
||||
.map(Cow::Owned)
|
||||
|
@ -157,7 +157,7 @@ pub fn install_crates(
|
|||
.registries
|
||||
.as_ref()
|
||||
.and_then(|registries| registries.get(®istry_name))
|
||||
.map(|registry| Cow::Borrowed(registry.index.as_str()))
|
||||
.and_then(|registry| registry.index.as_deref().map(Cow::Borrowed))
|
||||
.ok_or_else(|| BinstallError::UnknownRegistryName(registry_name))
|
||||
})?
|
||||
.parse()
|
||||
|
|
|
@ -52,12 +52,12 @@ pub enum Env {
|
|||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Registry {
|
||||
pub index: CompactString,
|
||||
pub index: Option<CompactString>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct DefaultRegistry {
|
||||
pub default: CompactString,
|
||||
pub default: Option<CompactString>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize)]
|
||||
|
|
Loading…
Add table
Reference in a new issue