rust-lang / rust-lang/rust-clippy

`#[expect(clippy::missing_docs_in_private_items)]` causes `unfulfilled_lint_expectations` when building tests

Open
#16,934 2 comments 0 reactions 1 assignee View on GitHub

@Kokoro2336 is already working on this.

Since Apr 30, 2026.

C-bug I-false-negative
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

The same as https://github.com/rust-lang/rust/issues/130021; Clippy inherited this code from rustc:

https://github.com/rust-lang/rust-clippy/blob/da29c3e2590764f9b6e42d088bf725969b41261c/clippy_lints/src/missing_doc.rs#L73-L75

rustc removed it in https://github.com/rust-lang/rust/pull/130025, which fixed missing_docs, but clippy::missing_docs_in_private_items has not picked that up.

(I don’t know whether this counts as a false negative or a false positive…)

Lint Name

missing_docs_in_private_items

Reproducer

I tried this code:

#![warn(clippy::missing_docs_in_private_items)]

pub fn public() {
    private();
}

#[expect(clippy::missing_docs_in_private_items)]
fn private() {}

I expected to see this happen:

shion:/v/f/1/j/T/tmp.xdpOLKV5bl/clippy-bug-reproducer
❭ cargo clippy --all-targets
    Checking clippy-bug-reproducer v0.1.0 (/private/var/folders/1v/jtp_4pzx7xq371f8j_xdnrvm0000gn/T/tmp.xdpOLKV5bl/clippy-bug-reproducer)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s

Instead, this happened:

shion:/v/f/1/j/T/tmp.xdpOLKV5bl/clippy-bug-reproducer
❭ cargo clippy --all-targets
    Checking clippy-bug-reproducer v0.1.0 (/private/var/folders/1v/jtp_4pzx7xq371f8j_xdnrvm0000gn/T/tmp.xdpOLKV5bl/clippy-bug-reproducer)
warning: this lint expectation is unfulfilled
 --> src/lib.rs:7:10
  |
7 | #[expect(clippy::missing_docs_in_private_items)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unfulfilled_lint_expectations)]` on by default

warning: `clippy-bug-reproducer` (lib test) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
Version
rustc 1.94.0 (4a4ef493e 2026-03-02) (built from a source tarball)
binary: rustc
commit-hash: 4a4ef493e3a1488c6e321570238084b38948f6db
commit-date: 2026-03-02
host: aarch64-apple-darwin
release: 1.94.0
LLVM version: 21.1.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.