rust-lang / rust-lang/rfcs

Rustdoc should support inline or same-line doc comments for enums

Open
#3,306 3 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

Hi,

As suggested in an old and closed but still active discussion, I open another thread because it looks interesting to have the capability to have inline comments.
My use case concerns a CLI which should parse the arguments, so in order to not reinvent the wheel I have tried with Clap .

Clap looks to use the rust documentation to display the sub-command comments.
Unfortunately, it is not possible today to align the action with the comment.
Indeed it becomes more readable when the comment is on the same line (like it is displayed with the sub-command "help").

_// Here an example with sub-commands from GIT_
enum Action {
    Clone,  //< Display file's information rights (size,rights).
    Init,   //< Create an empty Git repository or reinitialize an existing one
    Add     //< Add file contents to the index
}

For this use case, the comment should be "short and pithy" but it does not look to be an anti pattern as discussed in this thread.

Thanks in advance for your feedback and the work you're realizing.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked Rust RFC discussion 920 and the RFC pull request 2374, then review how rustdoc currently handles enum documentation. Compare the requested same-line comments with the existing sub-command help behavior described in the issue. Done means an agreed design for inline enum documentation comments and an accepted RFC or implementation path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.