diff --git a/crates/bin/src/entry.rs b/crates/bin/src/entry.rs index 4fa03672..a51f16b3 100644 --- a/crates/bin/src/entry.rs +++ b/crates/bin/src/entry.rs @@ -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() diff --git a/crates/binstalk-manifests/src/cargo_config.rs b/crates/binstalk-manifests/src/cargo_config.rs index 195650eb..21fac013 100644 --- a/crates/binstalk-manifests/src/cargo_config.rs +++ b/crates/binstalk-manifests/src/cargo_config.rs @@ -52,12 +52,12 @@ pub enum Env { #[derive(Debug, Deserialize)] pub struct Registry { - pub index: CompactString, + pub index: Option, } #[derive(Debug, Deserialize)] pub struct DefaultRegistry { - pub default: CompactString, + pub default: Option, } #[derive(Debug, Default, Deserialize)]