Skip to content

doc_markdown now fires on private items #12487

Closed
@kpreid

Description

@kpreid

Summary

Previously, doc_markdown would only lint public documentation. Now it also lints documentation on private items (which Rustdoc does not document by default). This isn't necessarily wrong, but it is a new behavior in nightly Clippy (not 1.76.0 or 1.77.0-beta.7), and I don't see any issue or PR describing it as an intended change, so I suspect it is a bug.

Lint Name

doc_markdown

Reproducer

I tried this code:

#![warn(clippy::doc_markdown)]
#![allow(unused)]

pub struct Foo {
    /// some_identifier
    bar: u8,
}

I saw this happen:

warning: item in documentation is missing backticks
 --> src/lib.rs:5:9
  |
5 |     /// some_identifier
  |         ^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
note: the lint level is defined here
 --> src/lib.rs:1:9
  |
1 | #![warn(clippy::doc_markdown)]
  |         ^^^^^^^^^^^^^^^^^^^^
help: try
  |
5 |     /// `some_identifier`
  |         ~~~~~~~~~~~~~~~~~

I expected to see this happen: No warning

Version

rustc 1.78.0-nightly (9c3ad802d 2024-03-07)
binary: rustc
commit-hash: 9c3ad802d9b9633d60d3a74668eb1be819212d34
commit-date: 2024-03-07
host: x86_64-apple-darwin
release: 1.78.0-nightly
LLVM version: 18.1.0

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions