Skip to content

Commit

Permalink
refactor: use registry_key for getting crates.io key
Browse files Browse the repository at this point in the history
`registry_key` should always be `crates-io` when `is_crates_io()` is true
  • Loading branch information
weihanglo committed Sep 21, 2023
1 parent d1ffef6 commit 12acc02
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/cargo/core/source_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,7 @@ impl SourceId {

/// Displays the name of a registry if it has one. Otherwise just the URL.
pub fn display_registry_name(self) -> String {
if self.is_crates_io() {
CRATES_IO_REGISTRY.to_string()
} else if let Some(key) = self.inner.registry_key.as_ref().map(|k| k.key()) {
if let Some(key) = self.inner.registry_key.as_ref().map(|k| k.key()) {
key.into()
} else if self.precise().is_some() {
// We remove `precise` here to retrieve an permissive version of
Expand Down

0 comments on commit 12acc02

Please sign in to comment.