Skip to content

Commit

Permalink
Use existing arg_dry_run function.
Browse files Browse the repository at this point in the history
And drop the `-n` short flag until we decide to commit to using it
generally.
  • Loading branch information
ehuss committed Sep 7, 2023
1 parent 53adc7e commit 226933f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions src/bin/cargo/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ pub fn cli() -> Command {
.arg_target_triple("Target triple to clean output for")
.arg_target_dir()
.arg_manifest_path()
.arg(
flag(
"dry-run",
"Display what would be deleted without deleting anything",
)
.short('n'),
)
.arg_dry_run("Display what would be deleted without deleting anything")
.after_help("Run `cargo help clean` for more detailed information.\n")
}

Expand All @@ -38,7 +32,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
requested_profile: args.get_profile_name(config, "dev", ProfileChecking::Custom)?,
profile_specified: args.contains_id("profile") || args.flag("release"),
doc: args.flag("doc"),
dry_run: args.flag("dry-run"),
dry_run: args.dry_run(),
};
ops::clean(&ws, &opts)?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_clean/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Usage: cargo[EXE] clean [OPTIONS]
Options:
--doc Whether or not to clean just the documentation directory
-q, --quiet Do not print cargo log messages
-n, --dry-run Display what would be deleted without deleting anything
--dry-run Display what would be deleted without deleting anything
-v, --verbose... Use verbose output (-vv very verbose/build.rs output)
--color <WHEN> Coloring: auto, always, never
--config <KEY=VALUE> Override a configuration value
Expand Down

0 comments on commit 226933f

Please sign in to comment.