Fix test for about method resolution in clap_derive
@@ -95,7 +95,6 @@ pub struct Attrs {
methods: Vec<Method>,
parser: Sp<Parser>,
author: Option<Method>,
- about: Option<Method>,
version: Option<Method>,
verbatim_doc_comment: Option<Ident>,
is_enum: bool,
@@ -257,7 +256,6 @@ impl Attrs {
doc_comment: vec![],
methods: vec![],
parser: Parser::default_spanned(default_span),
- about: None,
author: None,
version: None,
verbatim_doc_comment: None,
@@ -342,7 +340,10 @@ impl Attrs {
}
About(ident, about) => {
- self.about = Method::from_lit_or_env(ident, about, "CARGO_PKG_DESCRIPTION");
+ let method = Method::from_lit_or_env(ident, about, "CARGO_PKG_DESCRIPTION");
+ if let Some(m) = method {
+ self.methods.push(m);
+ }
}
Author(ident, author) => {
@@ -583,11 +584,10 @@ impl Attrs {
/// generate methods from attributes on top of struct or enum
pub fn top_level_methods(&self) -> TokenStream {
let author = &self.author;
- let about = &self.about;
let methods = &self.methods;
let doc_comment = &self.doc_comment;
- quote!( #(#doc_comment)* #author #about #(#methods)* )
+ quote!( #(#doc_comment)* #author #(#methods)*)
}
/// generate methods on top of a field
