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

+5-1
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

+1-1
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

+7-7
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

+1-1
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

+2-2
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

+2-2
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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")

tests/testsuite/git.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2358,7 +2358,7 @@ fn include_overrides_gitignore() {
23582358
p.cargo("build -v")
23592359
.with_stderr(
23602360
"\
2361-
[UPDATING] registry `[..]`
2361+
[UPDATING] `[..]` index
23622362
[DOWNLOADING] filetime [..]
23632363
[DOWNLOADING] libc [..]
23642364
[COMPILING] libc [..]

tests/testsuite/install.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn simple() {
2626
cargo_process("install foo")
2727
.with_stderr(
2828
"\
29-
[UPDATING] registry `[..]`
29+
[UPDATING] `[..]` index
3030
[DOWNLOADING] foo v0.0.1 (registry [..])
3131
[INSTALLING] foo v0.0.1
3232
[COMPILING] foo v0.0.1
@@ -52,7 +52,7 @@ fn multiple_pkgs() {
5252
.with_status(101)
5353
.with_stderr(
5454
"\
55-
[UPDATING] registry `[..]`
55+
[UPDATING] `[..]` index
5656
[DOWNLOADING] foo v0.0.1 (registry `CWD/registry`)
5757
[INSTALLING] foo v0.0.1
5858
[COMPILING] foo v0.0.1
@@ -96,7 +96,7 @@ fn pick_max_version() {
9696
cargo_process("install foo")
9797
.with_stderr(
9898
"\
99-
[UPDATING] registry `[..]`
99+
[UPDATING] `[..]` index
100100
[DOWNLOADING] foo v0.2.1 (registry [..])
101101
[INSTALLING] foo v0.2.1
102102
[COMPILING] foo v0.2.1
@@ -129,7 +129,7 @@ fn missing() {
129129
.with_status(101)
130130
.with_stderr(
131131
"\
132-
[UPDATING] registry [..]
132+
[UPDATING] [..] index
133133
[ERROR] could not find `bar` in registry `[..]`
134134
",
135135
).run();
@@ -142,7 +142,7 @@ fn bad_version() {
142142
.with_status(101)
143143
.with_stderr(
144144
"\
145-
[UPDATING] registry [..]
145+
[UPDATING] [..] index
146146
[ERROR] could not find `foo` in registry `[..]` with version `=0.2.0`
147147
",
148148
).run();

tests/testsuite/lockfile_compat.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
224224
.with_status(101)
225225
.with_stderr(
226226
"\
227-
[UPDATING] registry `[..]`
227+
[UPDATING] `[..]` index
228228
error: checksum for `bar v0.1.0` changed between lock files
229229
230230
this could be indicative of a few possible errors:
@@ -284,7 +284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
284284
.with_status(101)
285285
.with_stderr(
286286
"\
287-
[UPDATING] registry `[..]`
287+
[UPDATING] `[..]` index
288288
error: checksum for `bar v0.1.0` was not previously calculated, but a checksum \
289289
could now be calculated
290290
@@ -479,7 +479,7 @@ fn locked_correct_error() {
479479
.with_status(101)
480480
.with_stderr(
481481
"\
482-
[UPDATING] registry `[..]`
482+
[UPDATING] `[..]` index
483483
error: the lock file needs to be updated but --locked was passed to prevent this
484484
",
485485
).run();

tests/testsuite/overrides.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn override_simple() {
3838
p.cargo("build")
3939
.with_stderr(
4040
"\
41-
[UPDATING] registry `file://[..]`
41+
[UPDATING] `file://[..]` index
4242
[UPDATING] git repository `[..]`
4343
[COMPILING] bar v0.1.0 (file://[..])
4444
[COMPILING] foo v0.0.1 (CWD)
@@ -183,7 +183,7 @@ fn transitive() {
183183
p.cargo("build")
184184
.with_stderr(
185185
"\
186-
[UPDATING] registry `file://[..]`
186+
[UPDATING] `file://[..]` index
187187
[UPDATING] git repository `[..]`
188188
[DOWNLOADING] baz v0.2.0 (registry [..])
189189
[COMPILING] bar v0.1.0 (file://[..])
@@ -231,7 +231,7 @@ fn persists_across_rebuilds() {
231231
p.cargo("build")
232232
.with_stderr(
233233
"\
234-
[UPDATING] registry `file://[..]`
234+
[UPDATING] `file://[..]` index
235235
[UPDATING] git repository `file://[..]`
236236
[COMPILING] bar v0.1.0 (file://[..])
237237
[COMPILING] foo v0.0.1 (CWD)
@@ -275,7 +275,7 @@ fn replace_registry_with_path() {
275275
p.cargo("build")
276276
.with_stderr(
277277
"\
278-
[UPDATING] registry `file://[..]`
278+
[UPDATING] `file://[..]` index
279279
[COMPILING] bar v0.1.0 (file://[..])
280280
[COMPILING] foo v0.0.1 (CWD)
281281
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
@@ -336,7 +336,7 @@ fn use_a_spec_to_select() {
336336
p.cargo("build")
337337
.with_stderr(
338338
"\
339-
[UPDATING] registry `file://[..]`
339+
[UPDATING] `file://[..]` index
340340
[UPDATING] git repository `[..]`
341341
[DOWNLOADING] [..]
342342
[DOWNLOADING] [..]
@@ -393,7 +393,7 @@ fn override_adds_some_deps() {
393393
p.cargo("build")
394394
.with_stderr(
395395
"\
396-
[UPDATING] registry `file://[..]`
396+
[UPDATING] `file://[..]` index
397397
[UPDATING] git repository `[..]`
398398
[DOWNLOADING] baz v0.1.1 (registry [..])
399399
[COMPILING] baz v0.1.1
@@ -411,13 +411,13 @@ fn override_adds_some_deps() {
411411
.with_stderr(
412412
"\
413413
[UPDATING] git repository `file://[..]`
414-
[UPDATING] registry `file://[..]`
414+
[UPDATING] `file://[..]` index
415415
",
416416
).run();
417417
p.cargo("update -p https://github.com/rust-lang/crates.io-index#bar")
418418
.with_stderr(
419419
"\
420-
[UPDATING] registry `file://[..]`
420+
[UPDATING] `file://[..]` index
421421
",
422422
).run();
423423

@@ -508,7 +508,7 @@ fn override_wrong_name() {
508508
.with_status(101)
509509
.with_stderr(
510510
"\
511-
[UPDATING] registry [..]
511+
[UPDATING] [..] index
512512
[UPDATING] git repository [..]
513513
error: no matching package for override `[..]baz:0.1.0` found
514514
location searched: file://[..]
@@ -550,7 +550,7 @@ fn override_with_nothing() {
550550
.with_status(101)
551551
.with_stderr(
552552
"\
553-
[UPDATING] registry [..]
553+
[UPDATING] [..] index
554554
[UPDATING] git repository [..]
555555
[ERROR] failed to load source for a dependency on `bar`
556556
@@ -629,7 +629,7 @@ fn multiple_specs() {
629629
.with_status(101)
630630
.with_stderr(
631631
"\
632-
[UPDATING] registry [..]
632+
[UPDATING] [..] index
633633
[UPDATING] git repository [..]
634634
error: overlapping replacement specifications found:
635635
@@ -717,7 +717,7 @@ fn update() {
717717
p.cargo("update")
718718
.with_stderr(
719719
"\
720-
[UPDATING] registry `[..]`
720+
[UPDATING] `[..]` index
721721
[UPDATING] git repository `[..]`
722722
",
723723
).run();
@@ -1039,7 +1039,7 @@ fn no_warnings_when_replace_is_used_in_another_workspace_member() {
10391039
.with_stdout("")
10401040
.with_stderr(
10411041
"\
1042-
[UPDATING] registry `[..]`
1042+
[UPDATING] `[..]` index
10431043
[COMPILING] bar v0.1.0 ([..])
10441044
[COMPILING] first_crate v0.1.0 ([..])
10451045
[FINISHED] [..]",

0 commit comments

Comments
 (0)