From ca2846615cfcc439dd9465990ff0cc69aa6bf991 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 10 Jun 2022 19:35:25 -0500 Subject: [PATCH] docs(parser): Encourage people to read the whole deprecation message --- src/parser/matches/arg_matches.rs | 12 ++++++------ tests/derive_ui/next/bool_value_enum.stderr | 2 +- tests/derive_ui/non_existent_attr.stderr | 4 ++-- tests/derive_ui/stable/bool_value_enum.stderr | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/parser/matches/arg_matches.rs b/src/parser/matches/arg_matches.rs index f2cd14d4994..8dfdd9dd6a2 100644 --- a/src/parser/matches/arg_matches.rs +++ b/src/parser/matches/arg_matches.rs @@ -521,11 +521,11 @@ impl ArgMatches { self.values_of_t(name).unwrap_or_else(|e| e.exit()) } - /// Deprecated, replaced with [`ArgMatches::contains_id`] or - /// [`ArgAction::SetTrue`][crate::ArgAction]. + /// Deprecated, replaced with [`ArgAction::SetTrue`][crate::ArgAction] or + /// [`ArgMatches::contains_id`]. #[deprecated( since = "3.2.0", - note = "Replaced with either `ArgMatches::contains_id(...)` or `ArgAction::SetTrue`" + note = "Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)`" )] pub fn is_present(&self, id: T) -> bool { let id = Id::from(id); @@ -565,11 +565,11 @@ impl ArgMatches { value.and_then(MatchedArg::source) } - /// Deprecated, replaced with [`ArgMatches::get_many`]`.len()` or - /// [`ArgAction::Count`][crate::ArgAction]. + /// Deprecated, replaced with [`ArgAction::Count`][crate::ArgAction] or + /// [`ArgMatches::get_many`]`.len()`. #[deprecated( since = "3.2.0", - note = "Replaced with either `ArgMatches::get_many(...).len()` or `ArgAction::Count`" + note = "Replaced with either `ArgAction::Count` or `ArgMatches::get_many(...).len()`" )] pub fn occurrences_of(&self, id: T) -> u64 { #![allow(deprecated)] diff --git a/tests/derive_ui/next/bool_value_enum.stderr b/tests/derive_ui/next/bool_value_enum.stderr index 3cf48c81ad0..f85ea11672e 100644 --- a/tests/derive_ui/next/bool_value_enum.stderr +++ b/tests/derive_ui/next/bool_value_enum.stderr @@ -35,7 +35,7 @@ help: `bool` is a unit variant, you need to write it without the parenthesis 7 | opts: bool, | ~~~~ -warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgMatches::contains_id(...)` or `ArgAction::SetTrue` +warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)` --> tests/derive_ui/next/bool_value_enum.rs:7:11 | 7 | opts: bool, diff --git a/tests/derive_ui/non_existent_attr.stderr b/tests/derive_ui/non_existent_attr.stderr index 1bd9b5f66db..c970b909c8f 100644 --- a/tests/derive_ui/non_existent_attr.stderr +++ b/tests/derive_ui/non_existent_attr.stderr @@ -1,4 +1,4 @@ -warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgMatches::contains_id(...)` or `ArgAction::SetTrue` +warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)` --> tests/derive_ui/non_existent_attr.rs:15:12 | 15 | debug: bool, @@ -6,7 +6,7 @@ warning: use of deprecated associated function `clap::ArgMatches::is_present`: R | = note: `#[warn(deprecated)]` on by default -warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgMatches::contains_id(...)` or `ArgAction::SetTrue` +warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)` --> tests/derive_ui/non_existent_attr.rs:15:12 | 15 | debug: bool, diff --git a/tests/derive_ui/stable/bool_value_enum.stderr b/tests/derive_ui/stable/bool_value_enum.stderr index e6136dbb175..de052c39e61 100644 --- a/tests/derive_ui/stable/bool_value_enum.stderr +++ b/tests/derive_ui/stable/bool_value_enum.stderr @@ -35,7 +35,7 @@ help: `bool` is a unit variant, you need to write it without the parenthesis 7 | opts: bool, | ~~~~ -warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgMatches::contains_id(...)` or `ArgAction::SetTrue` +warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)` --> tests/derive_ui/stable/bool_value_enum.rs:7:11 | 7 | opts: bool,