Skip to content

rustdoctest: no allow lints are put in doctests, contradicting Rustdoc Book #45750

Closed
@QuietMisdreavus

Description

@QuietMisdreavus

image

In the current Rustdoc Book, it mentions that a few lints are automatically allowed in doctests:

Some common allow attributes are inserted, including unused_variables, unused_assignments, unused_mut, unused_attributes, and dead_code. Small examples often trigger these lints.

However, as the image above demonstrates, this does not seem to be the case. I have not added any #![doc(test(attr(warn(unused))))] or similar attributes to my crate, which would override such behavior. These warnings are usually suppressed, but adding --nocapture when running tests shows these warnings. (It also shows more important warnings, like unused_must_use, which helped in a different library of mine.)

@rust-lang/docs @rust-lang/dev-tools - Is this a docs issue (which would mean removing this entry from the Rustdoc Book) or a rustdoc issue (which would mean making sure these items are added)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-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