Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc_markdown now fires on private items #12487

Closed
kpreid opened this issue Mar 14, 2024 · 1 comment
Closed

doc_markdown now fires on private items #12487

kpreid opened this issue Mar 14, 2024 · 1 comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@kpreid
Copy link
Contributor

kpreid commented Mar 14, 2024

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

@kpreid kpreid added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Mar 14, 2024
@Alexendoo
Copy link
Member

Private items do get linted by doc lints, the change you're seeing here is because docs on struct fields and enum variants were (unintentionally) not being checked. That got fixed by #12342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

No branches or pull requests

2 participants