diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index e04f7ba2cff..0684dca6db3 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -245,6 +245,20 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> { } } + // Print success note on publish + if opts.registry.is_none() { + if let Some(ref registries) = pkg.publish() { + if registries[0] == CRATES_IO_REGISTRY { + if let Ok(packages) = opts.to_publish.get_packages(ws) { + for package in packages { + opts.config + .shell().note(format!("Your crate was successfully published to crates.io! You can visit it at https://crates.io/crates/{} .", package.name()))? + } + } + } + } + } + Ok(()) } diff --git a/tests/testsuite/publish.rs b/tests/testsuite/publish.rs index 00a79fe7362..8d4bbd36449 100644 --- a/tests/testsuite/publish.rs +++ b/tests/testsuite/publish.rs @@ -1030,7 +1030,7 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo note: Waiting [..] You may press ctrl-c [..] [PUBLISHED] foo v0.0.1 [..] -", +note: Your crate was successfully published to crates.io! You can visit it at https://crates.io/crates/foo .", ) .run(); }