Skip to content

Long trait bounds don't get broken up in rustdoc #41333

@clarfonthey

Description

@clarfonthey

Here's an example of some long bounds: num_traits::NumAssignOps

Copy-pasted here:

pub trait NumAssignOps<Rhs = Self>: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs> { }

Rustfmt, when given an adequately small width limit, will turn this into:

pub trait NumAssignOps<Rhs = Self>:
    AddAssign<Rhs>
    + SubAssign<Rhs>
    + MulAssign<Rhs>
    + DivAssign<Rhs>
    + RemAssign<Rhs>
{
}

It'd be nice if there were some way to make the rustdoc for these a bit less… awful, by default. Preferably without having to require that the user format their code accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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