Skip to content

Commit

Permalink
Merge pull request #3816 from epage/dep
Browse files Browse the repository at this point in the history
docs(parser): Encourage people to read the whole deprecation message
  • Loading branch information
epage committed Jun 11, 2022
2 parents 1c462be + ca28466 commit 8bb3853
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/parser/matches/arg_matches.rs
Expand Up @@ -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<T: Key>(&self, id: T) -> bool {
let id = Id::from(id);
Expand Down Expand Up @@ -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<T: Key>(&self, id: T) -> u64 {
#![allow(deprecated)]
Expand Down
2 changes: 1 addition & 1 deletion tests/derive_ui/next/bool_value_enum.stderr
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/derive_ui/non_existent_attr.stderr
@@ -1,12 +1,12 @@
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,
| ^^^^
|
= 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,
Expand Down
2 changes: 1 addition & 1 deletion tests/derive_ui/stable/bool_value_enum.stderr
Expand Up @@ -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,
Expand Down

0 comments on commit 8bb3853

Please sign in to comment.