From bc5b1f8890eb7b93a9e4048bc359317157fc05d8 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 19 Sep 2023 10:47:09 +0800 Subject: [PATCH] Better suggestion for unsupported mode in install command --- src/bin/cargo/commands/install.rs | 1 + src/cargo/util/command_prelude.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/cargo/commands/install.rs b/src/bin/cargo/commands/install.rs index 010a4f48385d..57063f11dc80 100644 --- a/src/bin/cargo/commands/install.rs +++ b/src/bin/cargo/commands/install.rs @@ -83,6 +83,7 @@ pub fn cli() -> Command { "debug", "Build in debug mode (with the 'dev' profile) instead of release mode", )) + .arg_unsupported_mode("release", "install", "debug") .arg_profile("Install artifacts with the specified profile") .arg_target_triple("Build for the target triple") .arg_target_dir() diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 303f965a74e0..270b558c6c2f 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -525,7 +525,7 @@ Run `{cmd}` to see possible targets." let name = match ( self.maybe_flag("release"), - self.flag("debug"), + self.maybe_flag("debug"), specified_profile, ) { (false, false, None) => default,