Open
Description
Summary
Apparently there are circumstances where missing_docs_in_private_items fails to report errors; they seem to have strange, non-local behavior.
Lint Name
missing_docs_in_private_items
Reproducer
I ran cargo clippy --all-features
with Rust 1.85 using this code as my lib.rs.
//! Documented.
#![deny(clippy::missing_docs_in_private_items)]
/// Documented.
#[derive(Debug)]
#[allow(dead_code)]
struct Mine {
//// Note use of four /s. No warning here.
undocumented_1: String,
}
#[derive(serde::Deserialize)]
pub(crate) struct Undocumented2 {}
Here's the Cargo.toml I used:
[package]
name = "clippy-repro"
version = "0.1.0"
edition = "2021"
[features]
f = []
[dependencies]
serde = { version = "1.0.218", features = ["derive"] }
I expected to see warnings from undocumented_1
and Undocumented2
.
Instead, no warnings were produced.
I tried removing #[derive(Debug)]
from Mine
: It caused a warning to start appearing on Undocumented2
!
I tried with older versions of Clippy: Rust version 1.78 and earlier correctly give warnings; Rust 1.79 is the first version that fails to warn at all.
Version
rustc 1.85.0 (4d91de4e4 2025-02-17)
binary: rustc
commit-hash: 4d91de4e48198da2e33413efdcd9cd2cc0c46688
commit-date: 2025-02-17
host: x86_64-unknown-linux-gnu
release: 1.85.0
LLVM version: 19.1.7