diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index dcfabb3c2597..20bf1154c169 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -331,7 +331,15 @@ pub trait CommandExt: Sized { } fn arg_quiet(self) -> Self { + let unsupported_silent_arg = { + let value_parser = UnknownArgumentValueParser::suggest_arg("--quiet"); + flag("silent", "") + .short('s') + .value_parser(value_parser) + .hide(true) + }; self._arg(flag("quiet", "Do not print cargo log messages").short('q')) + ._arg(unsupported_silent_arg) } fn arg_timings(self) -> Self { diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 2d65bb7f7de5..209cb8369aa4 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -46,9 +46,9 @@ fn unsupported_silent_arg() { p.cargo("run -s") .with_stderr( "\ -error: unexpected argument '-s' found +error: unexpected argument '--silent' found - tip: to pass '-s' as a value, use '-- -s' + tip: there is no `--silent` flag, use `--quiet` to suppress output Usage: cargo run [OPTIONS] [args]... @@ -63,7 +63,7 @@ For more information, try '--help'. "\ error: unexpected argument '--silent' found - tip: to pass '--silent' as a value, use '-- --silent' + tip: there is no `--silent` flag, use `--quiet` to suppress output Usage: cargo run [OPTIONS] [args]...