This repository was archived by the owner on Jan 1, 2022. It is now read-only.
This repository was archived by the owner on Jan 1, 2022. It is now read-only.
[Derive] #[doc = macro_name!()]
doesn't play well with doc comments #194
Open
Description
Issue by rami3l
Thursday Jul 29, 2021 at 19:22 GMT
Originally opened as clap-rs/clap#2639
Please complete the following tasks
- I have searched the discussions
- I have searched the existing issues
Rust Version
1.54.0
Clap Version
master
Minimal reproducible code
#[test]
fn doc_comments_raw_macro() {
macro_rules! doc_lorem_ipsum {
() => {
"Lorem ipsum"
};
(inner) => {
"Fooify a bar and a baz"
};
}
#[doc = doc_lorem_ipsum!()]
#[derive(Clap, PartialEq, Debug)]
struct LoremIpsum {
#[doc = doc_lorem_ipsum!(inner)]
#[clap(short, long)]
foo: bool,
}
let help = get_long_help::<LoremIpsum>();
assert!(help.contains("Lorem ipsum"));
assert!(help.contains("Fooify a bar and a baz"));
}
Steps to reproduce the bug with the above code
Run the test above.
Actual Behaviour
Assertions fail with no comments help message detected:
%%% LONG_HELP %%%:=====
clap_derive
USAGE:
clap_derive [FLAGS]
FLAGS:
-f, --foo
-h, --help
Prints help information
-V, --version
Prints version information
=====
Expected Behaviour
Assertions pass with all help messages specified by the macro call.
%%% LONG_HELP %%%:=====
clap_derive
<- We should see some help messages here...
USAGE:
clap_derive [FLAGS]
FLAGS:
-f, --foo <- And here...
-h, --help
Prints help information
-V, --version
Prints version information
=====
Additional Context
No response
Debug Output
No response