diff --git a/src/cargo/core/source_id.rs b/src/cargo/core/source_id.rs index 32acd0222c3d..42840b5efaa2 100644 --- a/src/cargo/core/source_id.rs +++ b/src/cargo/core/source_id.rs @@ -226,7 +226,7 @@ impl SourceId { } /// Creates a `SourceId` from a remote registry URL with given name. - pub fn for_alt_registry(url: &Url, name: &str) -> CargoResult { + pub fn for_named_registry(url: &Url, name: &str) -> CargoResult { let kind = Self::remote_source_kind(url); SourceId::new(kind, url.to_owned(), Some(name)) } @@ -284,7 +284,7 @@ impl SourceId { return Self::crates_io(config); } let url = config.get_registry_index(key)?; - Self::for_alt_registry(&url, key) + Self::for_named_registry(&url, key) } /// Gets this source URL. @@ -922,7 +922,7 @@ mod tests { assert_eq!(crate::util::hex::short_hash(&source_id), "fb60813d6cb8df79"); let url = "https://your-crates.io".into_url().unwrap(); - let source_id = SourceId::for_alt_registry(&url, "alt").unwrap(); + let source_id = SourceId::for_named_registry(&url, "alt").unwrap(); assert_eq!(gen_hash(source_id), 12862859764592646184); assert_eq!(crate::util::hex::short_hash(&source_id), "09c10fd0cbd74bce"); @@ -932,7 +932,7 @@ mod tests { assert_eq!(crate::util::hex::short_hash(&source_id), "d1ea0d96f6f759b5"); let url = "sparse+https://your-crates.io".into_url().unwrap(); - let source_id = SourceId::for_alt_registry(&url, "alt").unwrap(); + let source_id = SourceId::for_named_registry(&url, "alt").unwrap(); assert_eq!(gen_hash(source_id), 5159702466575482972); assert_eq!(crate::util::hex::short_hash(&source_id), "135d23074253cb78"); diff --git a/src/cargo/sources/config.rs b/src/cargo/sources/config.rs index f0c214e16d6f..1e9e39157122 100644 --- a/src/cargo/sources/config.rs +++ b/src/cargo/sources/config.rs @@ -112,7 +112,7 @@ impl<'cfg> SourceConfigMap<'cfg> { base.add( CRATES_IO_REGISTRY, SourceConfig { - id: SourceId::for_alt_registry(&url.parse()?, CRATES_IO_REGISTRY)?, + id: SourceId::for_named_registry(&url.parse()?, CRATES_IO_REGISTRY)?, replace_with: None, }, )?; @@ -239,7 +239,7 @@ restore the source replacement configuration to continue the build let mut srcs = Vec::new(); if let Some(registry) = def.registry { let url = url(®istry, &format!("source.{}.registry", name))?; - srcs.push(SourceId::for_alt_registry(&url, &name)?); + srcs.push(SourceId::for_named_registry(&url, &name)?); } if let Some(local_registry) = def.local_registry { let path = local_registry.resolve_path(self.config); diff --git a/src/cargo/util/config/mod.rs b/src/cargo/util/config/mod.rs index abbf905aeef2..01f92069c37d 100644 --- a/src/cargo/util/config/mod.rs +++ b/src/cargo/util/config/mod.rs @@ -1841,7 +1841,7 @@ impl Config { let source_id = self.crates_io_source_id.try_borrow_with(|| { self.check_registry_index_not_set()?; let url = CRATES_IO_INDEX.into_url().unwrap(); - SourceId::for_alt_registry(&url, CRATES_IO_REGISTRY) + SourceId::for_named_registry(&url, CRATES_IO_REGISTRY) })?; Ok(*source_id) } diff --git a/src/cargo/util/credential/paseto.rs b/src/cargo/util/credential/paseto.rs index bd49af98acdc..8f7bdd8673f3 100644 --- a/src/cargo/util/credential/paseto.rs +++ b/src/cargo/util/credential/paseto.rs @@ -65,7 +65,7 @@ impl<'a> Credential for PasetoCredential<'a> { ) -> Result { let index_url = Url::parse(registry.index_url).context("parsing index url")?; let sid = if let Some(name) = registry.name { - SourceId::for_alt_registry(&index_url, name) + SourceId::for_named_registry(&index_url, name) } else { SourceId::for_registry(&index_url) }?; diff --git a/src/cargo/util/credential/token.rs b/src/cargo/util/credential/token.rs index 7a29e6360d9f..3b012610d586 100644 --- a/src/cargo/util/credential/token.rs +++ b/src/cargo/util/credential/token.rs @@ -30,7 +30,7 @@ impl<'a> Credential for TokenCredential<'a> { ) -> Result { let index_url = Url::parse(registry.index_url).context("parsing index url")?; let sid = if let Some(name) = registry.name { - SourceId::for_alt_registry(&index_url, name) + SourceId::for_named_registry(&index_url, name) } else { SourceId::for_registry(&index_url) }?;