diff --git a/src/bin/cargo/commands/clean.rs b/src/bin/cargo/commands/clean.rs index 6fb126a3b..68b2db663 100644 --- a/src/bin/cargo/commands/clean.rs +++ b/src/bin/cargo/commands/clean.rs @@ -29,15 +29,14 @@ pub fn cli() -> Command { .hide(true) .value_name("KINDS") .value_parser( - PossibleValuesParser::new(["all", "download", "target", "shared-target"]).map( - |x| match x.as_str() { + PossibleValuesParser::new(["all", "download", "target"]).map(|x| { + match x.as_str() { "all" => AutoGcKind::All, "download" => AutoGcKind::Download, "target" => panic!("target is not yet implemented"), - "shared-target" => panic!("shared-target is not yet implemented"), x => panic!("possible value out of sync with `{x}`"), - }, - ), + } + }), ) .require_equals(true), ) @@ -150,17 +149,6 @@ pub fn cli() -> Command { .value_parser(parse_time_span) .hide(true), ) - .arg( - // TODO: come up with something less wordy? - opt( - "max-shared-target-age", - "Deletes any shared build artifact files that have not been used \ - since the given age (unstable) (UNIMPLEMENTED)", - ) - .value_name("DURATION") - .value_parser(parse_time_span) - .hide(true), - ) .arg( opt( "max-target-size", @@ -171,17 +159,6 @@ pub fn cli() -> Command { .value_parser(parse_human_size) .hide(true), ) - .arg( - // TODO: come up with something less wordy? - opt( - "max-shared-target-size", - "Deletes shared build artifact files until the cache is under the given size \ - (unstable) (UNIMPLEMENTED)", - ) - .value_name("SIZE") - .value_parser(parse_human_size) - .hide(true), - ) .after_help(color_print::cstr!( "Run `cargo help clean` for more detailed information.\n" )) @@ -255,9 +232,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { max_git_size: unstable_size_opt("max-git-size")?, max_download_size: unstable_size_opt("max-download-size")?, max_target_age: unimplemented_duration_opt("max-target-age")?, - max_shared_target_age: unimplemented_duration_opt("max-shared-target-age")?, max_target_size: unimplemented_size_opt("max-target-size")?, - max_shared_target_size: unimplemented_size_opt("max-shared-target-size")?, }; let max_download_age = unstable_duration_opt("max-download-age")?; gc_opts.update_for_auto_gc(config, &gc, max_download_age)?; diff --git a/src/cargo/core/gc.rs b/src/cargo/core/gc.rs index 807f0ce42..e1de1f4e9 100644 --- a/src/cargo/core/gc.rs +++ b/src/cargo/core/gc.rs @@ -137,12 +137,8 @@ pub struct GcOpts { /// The `--max-target-age` CLI option (UNIMPLEMENTED). pub max_target_age: Option, - /// The `--max-shared-target-age CLI option (UNIMPLEMENTED). - pub max_shared_target_age: Option, /// The `--max-target-size` CLI option (UNIMPLEMENTED). pub max_target_size: Option, - /// The `--max-shared-target-size` CLI option (UNIMPLEMENTED). - pub max_shared_target_size: Option, } impl GcOpts { @@ -169,10 +165,7 @@ impl GcOpts { /// Returns whether any target directory cleaning options are set. pub fn is_target_opt_set(&self) -> bool { - self.max_target_size.is_some() - || self.max_target_age.is_some() - || self.max_shared_target_age.is_some() - || self.max_shared_target_size.is_some() + self.max_target_size.is_some() || self.max_target_age.is_some() } /// Updates the configuration of this [`GcOpts`] to incorporate the @@ -256,7 +249,7 @@ impl GcOpts { .unwrap_or(DEFAULT_MAX_AGE_DOWNLOADED), )?; } - if matches!(kind, AutoGcKind::Target | AutoGcKind::SharedTarget) { + if matches!(kind, AutoGcKind::Target) { bail!("target is unimplemented"); } } @@ -291,12 +284,6 @@ pub enum AutoGcKind { /// /// This corresponds to `cargo clean --gc=target`. Target, - /// Automatically clean only the shared target directory. - /// - /// THIS IS NOT IMPLEMENTED. - /// - /// This corresponds to `cargo clean --gc=shared-target`. - SharedTarget, } /// Garbage collector. diff --git a/tests/testsuite/global_cache_tracker.rs b/tests/testsuite/global_cache_tracker.rs index 1c863caec..fe241ec1b 100644 --- a/tests/testsuite/global_cache_tracker.rs +++ b/tests/testsuite/global_cache_tracker.rs @@ -201,12 +201,7 @@ See [..] for more information about the `{trimmed_opt}` flag. .run(); } - for opt in [ - "--max-target-age=0 day", - "--max-shared-target-age=0 day", - "--max-target-size=0", - "--max-shared-target-size=0", - ] { + for opt in ["--max-target-age=0 day", "--max-target-size=0"] { let trimmed_opt = opt.split('=').next().unwrap(); p.cargo("clean") .arg(opt)