refactor(derive): Simplify verbatim docs tracking

This commit is contained in:
Ed Page 2022-08-26 14:44:04 -05:00
parent 2f4e42f227
commit f08575e4a3

View file

@ -44,7 +44,7 @@ pub struct Attrs {
methods: Vec<Method>, methods: Vec<Method>,
value_parser: Option<ValueParser>, value_parser: Option<ValueParser>,
action: Option<Action>, action: Option<Action>,
verbatim_doc_comment: Option<Ident>, verbatim_doc_comment: bool,
next_display_order: Option<Method>, next_display_order: Option<Method>,
next_help_heading: Option<Method>, next_help_heading: Option<Method>,
help_heading: Option<Method>, help_heading: Option<Method>,
@ -389,7 +389,7 @@ impl Attrs {
methods: vec![], methods: vec![],
value_parser: None, value_parser: None,
action: None, action: None,
verbatim_doc_comment: None, verbatim_doc_comment: false,
next_display_order: None, next_display_order: None,
next_help_heading: None, next_help_heading: None,
help_heading: None, help_heading: None,
@ -474,7 +474,7 @@ impl Attrs {
self.set_kind(kind); self.set_kind(kind);
} }
VerbatimDocComment(ident) => self.verbatim_doc_comment = Some(ident), VerbatimDocComment(_ident) => self.verbatim_doc_comment = true,
DefaultValueT(ident, expr) => { DefaultValueT(ident, expr) => {
let ty = if let Some(ty) = self.ty.as_ref() { let ty = if let Some(ty) = self.ty.as_ref() {
@ -750,8 +750,7 @@ impl Attrs {
}) })
.collect(); .collect();
self.doc_comment = self.doc_comment = process_doc_comment(comment_parts, name, !self.verbatim_doc_comment);
process_doc_comment(comment_parts, name, self.verbatim_doc_comment.is_none());
} }
fn set_kind(&mut self, kind: Sp<Kind>) { fn set_kind(&mut self, kind: Sp<Kind>) {