Skip to content

Commit f95eeb6

Browse files
committed
Auto merge of #14739 - weihanglo:cmd, r=epage
fix: clean up for deprecated and removed commands ### What does this PR try to resolve? This PR is a follow-up of <#14679>. * A new doc page for deprecated and removed commands * Remove shell completions for deprecated commands * Remove `verify-project` and `read-manifest` from `cargo --list` output. ### How should we test and review this PR? `mdbook serve src/doc` and read the doc. I've set up redirections for all removed/deprecated commands to maintain consistency, though only `verify-project` really need it I believe.
2 parents eb2be13 + 886e55b commit f95eeb6

File tree

12 files changed

+33
-20
lines changed

12 files changed

+33
-20
lines changed

src/bin/cargo/commands/git_checkout.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
//! Removed.
2+
13
use crate::command_prelude::*;
24

35
const REMOVED: &str = "The `git-checkout` command has been removed.";
46

57
pub fn cli() -> Command {
68
subcommand("git-checkout")
7-
.about("This command has been removed")
9+
.about("REMOVED: This command has been removed")
810
.hide(true)
911
.override_help(REMOVED)
1012
}

src/bin/cargo/commands/read_manifest.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
//! Deprecated.
2+
13
use crate::command_prelude::*;
24

35
pub fn cli() -> Command {
46
subcommand("read-manifest")
7+
.hide(true)
58
.about(color_print::cstr!(
69
"\
7-
Print a JSON representation of a Cargo.toml manifest.
10+
DEPRECATED: Print a JSON representation of a Cargo.toml manifest.
811
9-
Deprecated, use `<cyan,bold>cargo metadata --no-deps</>` instead.\
12+
Use `<cyan,bold>cargo metadata --no-deps</>` instead.\
1013
"
1114
))
1215
.arg_silent_suggestion()

src/bin/cargo/commands/verify_project.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
//! Deprecated.
2+
13
use crate::command_prelude::*;
24

35
use std::collections::HashMap;
46
use std::process;
57

68
pub fn cli() -> Command {
79
subcommand("verify-project")
10+
.hide(true)
811
.about(
912
"\
10-
Check correctness of crate manifest.
13+
DEPRECATED: Check correctness of crate manifest.
1114
12-
Deprecated, see https://github.com/rust-lang/cargo/issues/14679.",
15+
See https://github.com/rust-lang/cargo/issues/14679.",
1316
)
1417
.arg_silent_suggestion()
1518
.arg_manifest_path()

src/doc/book.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ search.use-boolean-and = true
1010

1111
[output.html.redirect]
1212
"/guide/build-cache.html" = "../reference/build-cache.html"
13+
"/commands/cargo-git-checkout.html" = "./deprecated-and-removed.html"
14+
"/commands/cargo-read-manifest.html" = "./deprecated-and-removed.html"
15+
"/commands/cargo-verify-project.html" = "./deprecated-and-removed.html"

src/doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
* [cargo package](commands/cargo-package.md)
9595
* [cargo publish](commands/cargo-publish.md)
9696
* [cargo yank](commands/cargo-yank.md)
97+
* [Deprecated and Removed](commands/deprecated-and-removed.md)
9798

9899
* [FAQ](faq.md)
99100
* [Appendix: Glossary](appendix/glossary.md)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Deprecated and Removed Commands
2+
3+
These commands have been deprecated or removed in early Rust releases.
4+
Deprecated commands receive only critical bug fixes,
5+
and may be removed in future versions.
6+
Removed commands are no longer functional and are unsupported.
7+
8+
* `read-manifest` --- deprecated since Rust 1.13
9+
* `git-checkout` --- removed since Rust 1.44
10+
* `verify-project` --- deprecated since Rust 1.84

src/doc/src/commands/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
* [Manifest Commands](manifest-commands.md)
55
* [Package Commands](package-commands.md)
66
* [Publishing Commands](publishing-commands.md)
7+
* [Deprecated and Removed](deprecated-and-removed.md)

src/etc/_cargo

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ _cargo() {
254254
'--dry-run[perform all checks without uploading]'
255255
;;
256256

257-
read-manifest)
258-
_arguments -s -S $common $manifest
259-
;;
260-
261257
remove | rm)
262258
_arguments -s -A "^--" $common $manifest \
263259
"--dev[remove as a dev dependency]" \
@@ -356,10 +352,6 @@ _cargo() {
356352
'*:package:_cargo_package_names'
357353
;;
358354

359-
verify-project)
360-
_arguments -s -S $common $manifest
361-
;;
362-
363355
version)
364356
_arguments -s -S $common
365357
;;

src/etc/cargo.bashcomp.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ _cargo()
7474
local opt__package="$opt_common $opt_mani $opt_feat $opt_lock $opt_parallel --allow-dirty -l --list --no-verify --no-metadata --index --registry --target --target-dir"
7575
local opt__pkgid="$opt_common $opt_mani $opt_lock $opt_pkg"
7676
local opt__publish="$opt_common $opt_mani $opt_feat $opt_lock $opt_parallel --allow-dirty --dry-run --token --no-verify --index --registry --target --target-dir"
77-
local opt__read_manifest="$opt_help $opt_quiet $opt_verbose $opt_mani $opt_color $opt_lock --no-deps"
7877
local opt__remove="$opt_common $opt_pkg $opt_lock $opt_mani --dry-run --dev --build --target"
7978
local opt__rm="$opt__remove"
8079
local opt__report="$opt_help $opt_verbose $opt_color future-incompat future-incompatibilities"
@@ -90,7 +89,6 @@ _cargo()
9089
local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root"
9190
local opt__update="$opt_common $opt_mani $opt_lock $opt_pkg --aggressive --recursive --precise --dry-run"
9291
local opt__vendor="$opt_common $opt_mani $opt_lock $opt_sync --no-delete --respect-source-config --versioned-dirs"
93-
local opt__verify_project="$opt_common $opt_mani $opt_lock"
9492
local opt__version="$opt_common $opt_lock"
9593
local opt__yank="$opt_common $opt_lock --version --undo --index --token --registry"
9694
local opt__libtest="--help --include-ignored --ignored --test --bench --list --logfile --nocapture --test-threads --skip -q --quiet --exact --color --format"

tests/testsuite/cargo_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn list_commands_with_descriptions() {
3636
...
3737
r alias: run
3838
...
39-
read-manifest Print a JSON representation of a Cargo.toml manifest.
39+
read-manifest DEPRECATED: Print a JSON representation of a Cargo.toml manifest.
4040
...
4141
t alias: test
4242
...

tests/testsuite/cargo_read_manifest/help/stdout.term.svg

Lines changed: 2 additions & 2 deletions
Loading

tests/testsuite/cargo_verify_project/help/stdout.term.svg

Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)