Summary
The same as rust-lang/rust#130021; Clippy inherited this code from rustc:
|
if cx.tcx.sess.opts.test { |
|
return false; |
|
} |
rustc removed it in rust-lang/rust#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
Summary
The same as rust-lang/rust#130021; Clippy inherited this code from rustc:
rust-clippy/clippy_lints/src/missing_doc.rs
Lines 73 to 75 in da29c3e
rustc removed it in rust-lang/rust#130025, which fixed
missing_docs, butclippy::missing_docs_in_private_itemshas 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:
I expected to see this happen:
Instead, this happened:
Version