From f08575e4a3e1ea345feef1ee4ac47e2a7a51aecb Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 26 Aug 2022 14:44:04 -0500 Subject: [PATCH] refactor(derive): Simplify verbatim docs tracking --- clap_derive/src/attrs.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/clap_derive/src/attrs.rs b/clap_derive/src/attrs.rs index 2aa068b6..9d402817 100644 --- a/clap_derive/src/attrs.rs +++ b/clap_derive/src/attrs.rs @@ -44,7 +44,7 @@ pub struct Attrs { methods: Vec, value_parser: Option, action: Option, - verbatim_doc_comment: Option, + verbatim_doc_comment: bool, next_display_order: Option, next_help_heading: Option, help_heading: Option, @@ -389,7 +389,7 @@ impl Attrs { methods: vec![], value_parser: None, action: None, - verbatim_doc_comment: None, + verbatim_doc_comment: false, next_display_order: None, next_help_heading: None, help_heading: None, @@ -474,7 +474,7 @@ impl Attrs { self.set_kind(kind); } - VerbatimDocComment(ident) => self.verbatim_doc_comment = Some(ident), + VerbatimDocComment(_ident) => self.verbatim_doc_comment = true, DefaultValueT(ident, expr) => { let ty = if let Some(ty) = self.ty.as_ref() { @@ -750,8 +750,7 @@ impl Attrs { }) .collect(); - self.doc_comment = - process_doc_comment(comment_parts, name, self.verbatim_doc_comment.is_none()); + self.doc_comment = process_doc_comment(comment_parts, name, !self.verbatim_doc_comment); } fn set_kind(&mut self, kind: Sp) {