diff --git a/clap_derive/src/utils/doc_comments.rs b/clap_derive/src/utils/doc_comments.rs index f0cb96218977..7ac872cf3640 100644 --- a/clap_derive/src/utils/doc_comments.rs +++ b/clap_derive/src/utils/doc_comments.rs @@ -61,7 +61,10 @@ pub fn process_doc_comment(lines: Vec, name: &str, preprocess: bool) -> lines.join("\n") }; - vec![Method::new(short_name, quote!(#short))] + vec![ + Method::new(short_name, quote!(#short)), + Method::new(long_name, quote!(None)), + ] } } diff --git a/tests/derive/doc_comments_help.rs b/tests/derive/doc_comments_help.rs index c35718b91f26..4b2d22c02e18 100644 --- a/tests/derive/doc_comments_help.rs +++ b/tests/derive/doc_comments_help.rs @@ -234,8 +234,7 @@ fn doc_comment_about_handles_both_abouts() { let app = Opts::into_app(); assert_eq!(app.get_about(), Some("Opts doc comment summary")); - assert_eq!( - app.get_long_about(), - Some("Sub doc comment summary\n\nSub doc comment body") - ); + // clap will fallback to `about` on `None`. The main care about is not providing a `Sub` doc + // comment. + assert_eq!(app.get_long_about(), None); }