rust-lang / rust-lang/rust

[rustdoc] Inline impl docstring headers when possible

Open
#144,809 0 comments 0 reactions 1 assignee View on GitHub

@lolbinarycat is already working on this.

Since Aug 2, 2025.

A-rustdoc-ui T-rustdoc-frontend
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

#141663 Added a way to collapse all impl blocks, which is one step closer to a great reading experience when using separate impls for splitting up your API documentation.

However, the impl blocks are currently spaced too far apart for a comfortable overview.

Here is an example viewing the egui::Ui documentation:

Image

A possible improvement would be to determine (possibly using some kind of heuristic) if it's possible to inline the first paragraph or header of the doc string, and if so, inline it.

Here is a mockup made in an image editor:

Image

This would make it much easier to overview impls.

The heuristic can be conservative. For starters, maybe it could just trigger for the simple case of impl Item, without any generics or bounds, to make it simple to implement.

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.