Merge pull request #3150 from japert/improve-subcommand-deprecation-message

Improve `SubCommand` deprecation message.
This commit is contained in:
Ed Page 2021-12-11 17:42:03 -06:00 committed by GitHub
commit 378e8d733d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,14 +74,18 @@ const INTERNAL_ERROR_MSG: &str = "Fatal internal error. Please consider filing a
report at https://github.com/clap-rs/clap/issues"; report at https://github.com/clap-rs/clap/issues";
const INVALID_UTF8: &str = "unexpected invalid UTF-8 code point"; const INVALID_UTF8: &str = "unexpected invalid UTF-8 code point";
/// Deprecated, replaced with [`App`] /// Deprecated, replaced with [`App::new`], unless you were looking for [Subcommand]
#[deprecated(since = "3.0.0", note = "Replaced with `App`")] #[deprecated(
since = "3.0.0",
note = "Replaced with `App::new` unless you intended the `Subcommand` trait"
)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct SubCommand {} pub struct SubCommand {}
#[allow(deprecated)] #[allow(deprecated)]
impl SubCommand { impl SubCommand {
/// Deprecated, replaced with [`App::new`] /// Deprecated, replaced with [`App::new`].
/// Did you mean Subcommand (lower-case c)?
#[deprecated(since = "3.0.0", note = "Replaced with `App::new`")] #[deprecated(since = "3.0.0", note = "Replaced with `App::new`")]
pub fn with_name<'help>(name: &str) -> App<'help> { pub fn with_name<'help>(name: &str) -> App<'help> {
App::new(name) App::new(name)