Skip to content

Commit

Permalink
Merge pull request #4276 from epage/derive
Browse files Browse the repository at this point in the history
fix(derive): Ensure clap/structopt attributes still work
  • Loading branch information
epage committed Sep 28, 2022
2 parents cad5cde + 24be631 commit 31e58cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clap_derive/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,10 +1261,12 @@ impl ToTokens for Deprecation {
}

fn assert_attr_kind(attr: &ClapAttr, possible_kind: &[AttrKind]) {
if !possible_kind.contains(attr.kind.get()) {
if *attr.kind.get() == AttrKind::Clap || *attr.kind.get() == AttrKind::StructOpt {
// deprecated
} else if !possible_kind.contains(attr.kind.get()) {
let options = possible_kind
.iter()
.map(|k| format!("`#[{}({})]", k.as_str(), attr.name))
.map(|k| format!("`#[{}({})]`", k.as_str(), attr.name))
.collect::<Vec<_>>();
abort!(
attr.name,
Expand Down

0 comments on commit 31e58cc

Please sign in to comment.