Skip to content

rustdoc: The short description of #[doc(cfg(target_feature = ...))] shouldn't spell out "target feature" #49334

Closed

Description

@kennytm

The words "target feature" are redundant

rustdoc's short description of #[doc(cfg(target_feature = ...))] is showing something like [x86-64 and target feature avx]. The words "target feature" is unnecessary since usually it is clear what avx means from context, i.e. [x86-64 and avx] should be clear enough.

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    on Mar 24, 2018
  2. QuietMisdreavus commented on Mar 27, 2018

    @QuietMisdreavus
    Contributor

    Notes to self:

    The issue at hand is the fact that the "short text" is overridden when the condition is combined with others. The target features are supposed to only show "avx" when they're by themselves, as shown in the OP of #48759. The offending snippet:

    impl<'a> fmt::Display for ShortHtml<'a> {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
    match *self.0 {
    Cfg::Cfg(ref name, Some(ref vendor)) if name == &"target_feature" => {
    write!(fmt, "<code>{}</code>", vendor)
    },
    ref cfg => write!(fmt, "{}", Html(cfg)),
    }
    }
    }

    The easiest way to fix this is to never print "target feature", even in the long form, but that text is still valuable there.

  3. added a commit that references this issue on May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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