[rustdoc] Inline impl docstring headers when possible
@lolbinarycat is already working on this.
Since Aug 2, 2025.
- 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:
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:
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.