Skip to content

rustdoc: Tuple Fields of Variant section is superfluous and noisy if all fields are undocumented #90824

Description

@orlp

I understand that if (at least one of) a tuple variant's fields is documented, we need a place to put that documentation. But if not this just adds superfluous noise. Especially if you have a lot of tuple enum variants with undocumented fields it becomes very noisy very quickly. As a real world example from one of my codebases:

pub enum RotationPolicy {
    /// Only rotate when [`RotatingFileWriter::rotate`] is called.
    Manual,
    /// Rotate when the active file exceeds this many bytes.
    SizeLimit(usize),
    /// Rotate periodically.
    Periodically(Period),
    /// Rotate both periodically and whenever the size limit is exceeded.
    SizeLimitAndPeriodically(usize, Period),
    /// A custom callback to determine when to rotate. Called after every write
    /// with the current active file size and age.
    Custom(Box<dyn FnMut(usize, Duration) -> bool>),
}

How it currently looks:

image

And with the superfluous sections removed:

image

I think we should get rid of any "Tuple Fields of Variant" section if that variants' fields are undocumented. It only adds noise and makes the documentation less readable in my opinion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-enhancementCategory: An issue proposing an enhancement or a PR with one.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