Skip to content

rustdoc discussion: collapsing sections by default #52520

Open
@nrc

Description

@nrc

IIUC, Rustdoc collapses all trait impls and the type declaration (cc #49412) by default. But leaves other sections expanded.

This seems good in many cases, but in others. We might want to adjust exactly how things are collapsed.

Some thoughts:

  • When collapsing the type decl, it would be nice to still see a minimal part of the signature, e.g., for Iterator there is good reason to not show all the methods, but it would be nice to show pub trait Iterator { ... } and maybe the Item assoc type. I realise all the information is there on the page, but it just looks incomplete without something there.
  • It is often useful to have type decl as a 'contents' page for the docs, especially if the intro text is very long. OTOH, it might be nice to actually have a contents (e.g., just the names of fields/methods) so that impl methods are included.
  • For trait impls, it would be nice to include the signatures of methods, but not the text descriptions (i.e., the trait impl is expanded, but each method is collapsed). The reasoning here is that often wants to know the names or signatures of methods in an impl, but not the descriptions (where I agree with the reasoning that it is not the most useful).
  • For traits, it would be good to further collapse the list of impls, see for example IntoIterator, it might be nice to have just a list of the types (rather than the signatures) with a click through to see the sig, or to keep the current style but collapse the whole list by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-discussionCategory: Discussion or questions that doesn't represent real issues.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions