fix(derive): Ensure clap/structopt attributes still work

The problem with updating all code to use non-deprecated APIs, there
aren't tests for the old way anymore.

Fixes #4274
This commit is contained in:
Ed Page 2022-09-28 14:29:31 -05:00
parent 79ba02daa5
commit 24be631f86

View file

@ -1261,7 +1261,9 @@ impl ToTokens for Deprecation {
} }
fn assert_attr_kind(attr: &ClapAttr, possible_kind: &[AttrKind]) { 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 let options = possible_kind
.iter() .iter()
.map(|k| format!("`#[{}({})]`", k.as_str(), attr.name)) .map(|k| format!("`#[{}({})]`", k.as_str(), attr.name))