diff --git a/src/cargo/core/package_id.rs b/src/cargo/core/package_id.rs index c11102017af..ca126172c6e 100644 --- a/src/cargo/core/package_id.rs +++ b/src/cargo/core/package_id.rs @@ -251,43 +251,6 @@ mod tests { assert!(PackageId::new("foo", "", repo).is_err()); } - #[test] - fn debug() { - let loc = CRATES_IO_INDEX.into_url().unwrap(); - let pkg_id = PackageId::new("foo", "1.0.0", SourceId::for_registry(&loc).unwrap()).unwrap(); - assert_eq!( - r#"PackageId { name: "foo", version: "1.0.0", source: "registry `crates-io`" }"#, - format!("{:?}", pkg_id) - ); - - let expected = r#" -PackageId { - name: "foo", - version: "1.0.0", - source: "registry `crates-io`", -} -"# - .trim(); - - // Can be removed once trailing commas in Debug have reached the stable - // channel. - let expected_without_trailing_comma = r#" -PackageId { - name: "foo", - version: "1.0.0", - source: "registry `crates-io`" -} -"# - .trim(); - - let actual = format!("{:#?}", pkg_id); - if actual.ends_with(",\n}") { - assert_eq!(actual, expected); - } else { - assert_eq!(actual, expected_without_trailing_comma); - } - } - #[test] fn display() { let loc = CRATES_IO_INDEX.into_url().unwrap(); diff --git a/src/cargo/core/source_id.rs b/src/cargo/core/source_id.rs index a3284812aa6..d688b873914 100644 --- a/src/cargo/core/source_id.rs +++ b/src/cargo/core/source_id.rs @@ -330,9 +330,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