When deriving Parser, multi-sentence doc comments have final period removed #3367
Labels
A-derive
Area: #[derive]` macro API
C-bug
Category: Updating dependencies
S-waiting-on-design
Status: Waiting on user-facing design to be resolved before implementing
Please complete the following tasks
Rust Version
rustc 1.58.1 (db9d1b20b 2022-01-20)
Clap Version
3.0.13
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo run -- -h
Actual Behaviour
The doc comment consists of multiple sentences, and it's difficult to rewrite it in a single sentence without losing critical information. But the final period is removed, resulting in a jarring and ungrammatical result:
In other cases, I've had to spend effort rewriting my doc comments into a single summary sentence, followed by extra paragraphs of explanation. Perhaps it's better for users, perhaps not. As an author I wish it wasn't necessary to do so to avoid structopt breaking my help output.
Also as a user I dislike how
-h
prints short output and--help
prints multi-paragraph output, even though the help output (-h, --help
) implies that these 2 commands are interchangeable. As a result, I often don't even know that multi-paragraph help even exists in Rust apps. (Admittedly git has different -h and --help, but I don't especially like that either.)Expected Behaviour
Either don't strip trailing periods from doc comments by default, or add a struct-wide or per-field option to disable stripping the trailing period. Ideally you could detect multi-sentence comments and avoid stripping the trailing period, but this may be difficult to implement without false positives or negatives.
I'm not sure how to unify the behavior of -h and --help, or address the odd formatting of
--help
showing 1 sentence followed by paragraphs.Additional Context
Somewhat related discussions:
Debug Output
No response
The text was updated successfully, but these errors were encountered: