Skip to content

Commit 5984312

Browse files
committed
Auto merge of #5990 - dwijnand:no-crates.io-index-url, r=alexcrichton
Don't print crates.io-index URL when Updating Following the lead from PackageId's Display, only display the registry's URL if it's not the default registry (aka crates.io). Before: $ cargo install lazy_static Updating registry `https://github.com/rust-lang/crates.io-index` After: $ dcargo install lazy_static Updating crates.io index Fixes #4208
2 parents 41f98f3 + 41aa6fb commit 5984312

22 files changed

+103
-99
lines changed

src/cargo/core/source/source_id.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ impl SourceId {
210210
}
211211

212212
pub fn display_registry(&self) -> String {
213-
format!("registry `{}`", self.url())
213+
if self.is_default_registry() {
214+
"crates.io index".to_string()
215+
} else {
216+
format!("`{}` index", self.url())
217+
}
214218
}
215219

216220
/// Is this source from a filesystem path

src/doc/src/guide/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ their dependencies, compile them all, and update the `Cargo.lock`:
4646

4747
```console
4848
$ cargo build
49-
Updating registry `https://github.com/rust-lang/crates.io-index`
49+
Updating crates.io index
5050
Downloading memchr v0.1.5
5151
Downloading libc v0.1.10
5252
Downloading regex-syntax v0.2.1

tests/testsuite/alt_registry.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn depend_on_alt_registry() {
5656
.masquerade_as_nightly_cargo()
5757
.with_stderr(&format!(
5858
"\
59-
[UPDATING] registry `{reg}`
59+
[UPDATING] `{reg}` index
6060
[DOWNLOADING] bar v0.0.1 (registry `file://[..]`)
6161
[COMPILING] bar v0.0.1 (registry `file://[..]`)
6262
[COMPILING] foo v0.0.1 (CWD)
@@ -109,7 +109,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
109109
.masquerade_as_nightly_cargo()
110110
.with_stderr(&format!(
111111
"\
112-
[UPDATING] registry `{reg}`
112+
[UPDATING] `{reg}` index
113113
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
114114
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
115115
[COMPILING] baz v0.0.1 (registry `file://[..]`)
@@ -151,7 +151,7 @@ fn depend_on_alt_registry_depends_on_same_registry() {
151151
.masquerade_as_nightly_cargo()
152152
.with_stderr(&format!(
153153
"\
154-
[UPDATING] registry `{reg}`
154+
[UPDATING] `{reg}` index
155155
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
156156
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
157157
[COMPILING] baz v0.0.1 (registry `file://[..]`)
@@ -193,8 +193,8 @@ fn depend_on_alt_registry_depends_on_crates_io() {
193193
.masquerade_as_nightly_cargo()
194194
.with_stderr(&format!(
195195
"\
196-
[UPDATING] registry `{alt_reg}`
197-
[UPDATING] registry `{reg}`
196+
[UPDATING] `{alt_reg}` index
197+
[UPDATING] `{reg}` index
198198
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
199199
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
200200
[COMPILING] baz v0.0.1 (registry `file://[..]`)
@@ -358,9 +358,9 @@ fn alt_registry_and_crates_io_deps() {
358358
p.cargo("build")
359359
.masquerade_as_nightly_cargo()
360360
.with_stderr_contains(format!(
361-
"[UPDATING] registry `{}`",
361+
"[UPDATING] `{}` index",
362362
registry::alt_registry()
363-
)).with_stderr_contains(&format!("[UPDATING] registry `{}`", registry::registry()))
363+
)).with_stderr_contains(&format!("[UPDATING] `{}` index", registry::registry()))
364364
.with_stderr_contains("[DOWNLOADING] crates_io_dep v0.0.1 (registry `file://[..]`)")
365365
.with_stderr_contains("[DOWNLOADING] alt_reg_dep v0.1.0 (registry `file://[..]`)")
366366
.with_stderr_contains("[COMPILING] alt_reg_dep v0.1.0 (registry `file://[..]`)")

tests/testsuite/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3551,7 +3551,7 @@ fn build_all_member_dependency_same_name() {
35513551

35523552
p.cargo("build --all")
35533553
.with_stderr(
3554-
"[..] Updating registry `[..]`\n\
3554+
"[..] Updating `[..]` index\n\
35553555
[..] Downloading a v0.1.0 ([..])\n\
35563556
[..] Compiling a v0.1.0\n\
35573557
[..] Compiling a v0.1.0 ([..])\n\

tests/testsuite/build_script.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ fn warnings_hidden_for_upstream() {
27062706
p.cargo("build -v")
27072707
.with_stderr(
27082708
"\
2709-
[UPDATING] registry `[..]`
2709+
[UPDATING] `[..]` index
27102710
[DOWNLOADING] bar v0.1.0 ([..])
27112711
[COMPILING] bar v0.1.0
27122712
[RUNNING] `rustc [..]`
@@ -2760,7 +2760,7 @@ fn warnings_printed_on_vv() {
27602760
p.cargo("build -vv")
27612761
.with_stderr(
27622762
"\
2763-
[UPDATING] registry `[..]`
2763+
[UPDATING] `[..]` index
27642764
[DOWNLOADING] bar v0.1.0 ([..])
27652765
[COMPILING] bar v0.1.0
27662766
[RUNNING] `rustc [..]`

tests/testsuite/cfg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn works_through_the_registry() {
222222
p.cargo("build")
223223
.with_stderr(
224224
"\
225-
[UPDATING] registry [..]
225+
[UPDATING] [..] index
226226
[DOWNLOADING] [..]
227227
[DOWNLOADING] [..]
228228
[COMPILING] baz v0.1.0
@@ -266,7 +266,7 @@ fn ignore_version_from_other_platform() {
266266
p.cargo("build")
267267
.with_stderr(
268268
"\
269-
[UPDATING] registry [..]
269+
[UPDATING] [..] index
270270
[DOWNLOADING] [..]
271271
[COMPILING] bar v0.1.0
272272
[COMPILING] foo v0.0.1 ([..])

tests/testsuite/cross_publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn publish_with_target() {
104104
.arg("--target")
105105
.arg(&target)
106106
.with_stderr(&format!(
107-
" Updating registry `{registry}`
107+
" Updating `{registry}` index
108108
Packaging foo v0.0.0 (CWD)
109109
Verifying foo v0.0.0 (CWD)
110110
Compiling foo v0.0.0 (CWD/target/package/foo-0.0.0)

tests/testsuite/directory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn crates_io_then_directory() {
330330
p.cargo("build")
331331
.with_stderr(
332332
"\
333-
[UPDATING] registry `[..]`
333+
[UPDATING] `[..]` index
334334
[DOWNLOADING] bar v0.1.0 ([..])
335335
[COMPILING] bar v0.1.0
336336
[COMPILING] foo v0.1.0 (CWD)

tests/testsuite/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ fn doc_all_member_dependency_same_name() {
967967
Package::new("bar", "0.1.0").publish();
968968

969969
p.cargo("doc --all")
970-
.with_stderr_contains("[..] Updating registry `[..]`")
970+
.with_stderr_contains("[..] Updating `[..]` index")
971971
.with_stderr_contains("[..] Documenting bar v0.1.0 ([..])")
972972
.run();
973973
}

tests/testsuite/generate_lockfile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn no_index_update() {
8282
.build();
8383

8484
p.cargo("generate-lockfile")
85-
.with_stderr("[UPDATING] registry `[..]`")
85+
.with_stderr("[UPDATING] `[..]` index")
8686
.run();
8787

8888
p.cargo("generate-lockfile -Zno-index-update")

0 commit comments

Comments
 (0)