From 9041b53fd8b0ab1b3946a6acfafd9f8b41340127 Mon Sep 17 00:00:00 2001 From: Dodothereal <129273127+Dodothereal@users.noreply.github.com> Date: Wed, 24 Jun 2026 00:58:15 +0200 Subject: [PATCH 1/5] fix(clean): clarify why 'cargo clean' default != 'release' artifact set (#17129) Reword --release and --profile short help to convey that the flag *restricts* the set of artifacts cleaned to the named profile, rather than implying 'additionally clean release artifacts to the default cleanup set'. Without the flag, 'cargo clean' removes all artifacts; with --release (or any other profile) it removes only that profile's. The current wording 'Whether or not to clean release artifacts' reads as 'cargo clean may or may not include release; --release is the affirmative form', which contradicts the actual semantics. Closes #17129 Signed-off-by: Dodothereal <129273127+Dodothereal@users.noreply.github.com> --- src/bin/cargo/commands/clean.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/cargo/commands/clean.rs b/src/bin/cargo/commands/clean.rs index 0bde5a343a7..fadebd27e10 100644 --- a/src/bin/cargo/commands/clean.rs +++ b/src/bin/cargo/commands/clean.rs @@ -26,8 +26,8 @@ pub fn cli() -> Command { flag("workspace", "Clean artifacts of the workspace members") .help_heading(heading::PACKAGE_SELECTION), ) - .arg_release("Whether or not to clean release artifacts") - .arg_profile("Clean artifacts of the specified profile") + .arg_release("Clean only release artifacts") + .arg_profile("Clean only artifacts of the specified profile") .arg_target_triple("Target triple to clean output for") .arg_target_dir() .arg_manifest_path() From 2e4ccc46e6a41b1d4f77d1cb200266e8431989a6 Mon Sep 17 00:00:00 2001 From: Dodothereal <129273127+Dodothereal@users.noreply.github.com> Date: Wed, 24 Jun 2026 09:35:58 +0200 Subject: [PATCH 2/5] docs(clean): align --release/--profile long help with the revised short help The short help (cargo clean --help) now reads 'Clean only release artifacts' instead of 'Whether or not to clean release artifacts'. Align the man page / website long descriptions to use the same language so a maintainer reading `cargo help clean` or the man page gets the same semantics as the short help. Suggested by weihanglo's review of #17132: extend the same wording fix to the pre-existing help manual. Refs: #17129 Signed-off-by: Dodothereal <129273127+Dodothereal@users.noreply.github.com> --- src/doc/man/cargo-clean.md | 6 ++++-- src/doc/man/generated_txt/cargo-clean.txt | 6 ++++-- src/doc/src/commands/cargo-clean.md | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/doc/man/cargo-clean.md b/src/doc/man/cargo-clean.md index 05e34602e1c..f65cbb68b22 100644 --- a/src/doc/man/cargo-clean.md +++ b/src/doc/man/cargo-clean.md @@ -53,11 +53,13 @@ the target directory. {{/option}} {{#option "`--release`" }} -Remove all artifacts in the `release` directory. +Remove artifacts in the `release` directory only (instead of the default, +which removes all artifacts). {{/option}} {{#option "`--profile` _name_" }} -Remove all artifacts in the directory with the given profile name. +Remove artifacts only in the directory with the given profile name (instead +of the default, which removes all artifacts). {{/option}} {{> options-target-dir }} diff --git a/src/doc/man/generated_txt/cargo-clean.txt b/src/doc/man/generated_txt/cargo-clean.txt index a25c8f2a8ef..928350364df 100644 --- a/src/doc/man/generated_txt/cargo-clean.txt +++ b/src/doc/man/generated_txt/cargo-clean.txt @@ -35,10 +35,12 @@ OPTIONS in the target directory. --release - Remove all artifacts in the release directory. + Remove artifacts in the release directory only (instead of the + default, which removes all artifacts). --profile name - Remove all artifacts in the directory with the given profile name. + Remove artifacts only in the directory with the given profile name + (instead of the default, which removes all artifacts). --target-dir directory Directory for all generated artifacts and intermediate files. May diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md index 22da161097d..7e86994e8e8 100644 --- a/src/doc/src/commands/cargo-clean.md +++ b/src/doc/src/commands/cargo-clean.md @@ -54,12 +54,14 @@ the target directory.

--release
-

Remove all artifacts in the release directory.

+

Remove artifacts in the release directory only (instead of the +default, which removes all artifacts).

--profile name
-

Remove all artifacts in the directory with the given profile name.

+

Remove artifacts only in the directory with the given profile name +(instead of the default, which removes all artifacts).

From 6b8db79ee2d9cb1e818c9607cee4c15824e27876 Mon Sep 17 00:00:00 2001 From: Dodothereal <129273127+Dodothereal@users.noreply.github.com> Date: Wed, 24 Jun 2026 10:19:35 +0200 Subject: [PATCH 3/5] test(clean): refresh --help snapshot for revised --release/--profile short descriptions The first commit changed the short --help strings from "Whether or not to clean release artifacts" / "Clean artifacts of the specified profile" to "Clean only release artifacts" / "Clean only artifacts of the specified profile", but the cargo_clean help snapshot still captures the old wording. The follow-up commit aligned the man-page long descriptions; this commit refreshes the snapshot so the testsuite passes locally. Suggested follow-up to the ongoing review thread on #17132 ("help fix the CI" + LeandroVandari noting "stdout.term.svg expects the old cargo clean output"). Generated-by: Claude Signed-off-by: Dodothereal <129273127+Dodothereal@users.noreply.github.com> --- tests/testsuite/cargo_clean/help/stdout.term.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testsuite/cargo_clean/help/stdout.term.svg b/tests/testsuite/cargo_clean/help/stdout.term.svg index 1d60aa0010f..9d9a35a5c32 100644 --- a/tests/testsuite/cargo_clean/help/stdout.term.svg +++ b/tests/testsuite/cargo_clean/help/stdout.term.svg @@ -60,9 +60,9 @@ Compilation Options: - -r, --release Whether or not to clean release artifacts + -r, --release Clean only release artifacts - --profile <PROFILE-NAME> Clean artifacts of the specified profile + --profile <PROFILE-NAME> Clean only artifacts of the specified profile --target [<TRIPLE>] Target triple to clean output for From 5ffb034f41b6e563836c901112f572d7a2410919 Mon Sep 17 00:00:00 2001 From: Dodothereal <129273127+Dodothereal@users.noreply.github.com> Date: Wed, 24 Jun 2026 10:42:44 +0200 Subject: [PATCH 4/5] docs(clean): drop redundant parenthetical after LeandroVandari review "only ..." already conveys the restriction; the "(instead of the default, ...)" parenthetical is unnecessary noise in the long help. Refs: #17129. Closes review feedback from LeandroVandari on #17132. Signed-off-by: Dodothereal <129273127+Dodothereal@users.noreply.github.com> --- src/doc/man/cargo-clean.md | 6 ++---- src/doc/man/generated_txt/cargo-clean.txt | 6 ++---- src/doc/src/commands/cargo-clean.md | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/doc/man/cargo-clean.md b/src/doc/man/cargo-clean.md index f65cbb68b22..387f8445ca6 100644 --- a/src/doc/man/cargo-clean.md +++ b/src/doc/man/cargo-clean.md @@ -53,13 +53,11 @@ the target directory. {{/option}} {{#option "`--release`" }} -Remove artifacts in the `release` directory only (instead of the default, -which removes all artifacts). +Remove artifacts in the `release` directory only. {{/option}} {{#option "`--profile` _name_" }} -Remove artifacts only in the directory with the given profile name (instead -of the default, which removes all artifacts). +Remove artifacts only in the directory with the given profile name. {{/option}} {{> options-target-dir }} diff --git a/src/doc/man/generated_txt/cargo-clean.txt b/src/doc/man/generated_txt/cargo-clean.txt index 928350364df..99ae179e390 100644 --- a/src/doc/man/generated_txt/cargo-clean.txt +++ b/src/doc/man/generated_txt/cargo-clean.txt @@ -35,12 +35,10 @@ OPTIONS in the target directory. --release - Remove artifacts in the release directory only (instead of the - default, which removes all artifacts). + Remove artifacts in the release directory only. --profile name - Remove artifacts only in the directory with the given profile name - (instead of the default, which removes all artifacts). + Remove artifacts only in the directory with the given profile name. --target-dir directory Directory for all generated artifacts and intermediate files. May diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md index 7e86994e8e8..cce9aafc234 100644 --- a/src/doc/src/commands/cargo-clean.md +++ b/src/doc/src/commands/cargo-clean.md @@ -54,14 +54,12 @@ the target directory.

--release
-

Remove artifacts in the release directory only (instead of the -default, which removes all artifacts).

+

Remove artifacts in the release directory only.

--profile name
-

Remove artifacts only in the directory with the given profile name -(instead of the default, which removes all artifacts).

+

Remove artifacts only in the directory with the given profile name.

From d69feb4092c8842732ce2333c75fd2ee01adbe12 Mon Sep 17 00:00:00 2001 From: Dodothereal <129273127+Dodothereal@users.noreply.github.com> Date: Wed, 24 Jun 2026 11:04:14 +0200 Subject: [PATCH 5/5] test(man): regenerate cargo-clean.1 to match trimmed long help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the commit 5ffb034 dropped the parenthetical from the long --help text in src/doc/man/, src/etc/man/cargo-clean.1 (the generated man page) needs to be regenerated via \`cargo build-man\` for the docs CI to be green. No source text changes — purely a regeneration. Generated-by: Claude Signed-off-by: Dodothereal <129273127+Dodothereal@users.noreply.github.com> --- src/etc/man/cargo-clean.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1 index bbdebd3c8af..3ee8c54cb57 100644 --- a/src/etc/man/cargo-clean.1 +++ b/src/etc/man/cargo-clean.1 @@ -44,12 +44,12 @@ the target directory. .sp \fB\-\-release\fR .RS 4 -Remove all artifacts in the \fBrelease\fR directory. +Remove artifacts in the \fBrelease\fR directory only. .RE .sp \fB\-\-profile\fR \fIname\fR .RS 4 -Remove all artifacts in the directory with the given profile name. +Remove artifacts only in the directory with the given profile name. .RE .sp \fB\-\-target\-dir\fR \fIdirectory\fR