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

clippy::missing_docs_in_private_items detects const in fn but --document-private-items doesn't generate it. #13298

Closed
nogiro opened this issue Aug 24, 2024 · 0 comments · Fixed by #13573
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@nogiro
Copy link

nogiro commented Aug 24, 2024

Summary

clippy::missing_docs_in_private_items seems to trigger in const in fn, but cargo doc --document-private-items doesn't generate this const.

Lint Name

missing_docs_in_private_items

Reproducer

I tried this code:

#![warn(clippy::missing_docs_in_private_items)]

//! `const` in `fn`.

/// The application entry point.
fn main() {
    const MSG: &str = "Hello, world!";
    println!("{MSG}");
}

I expected to see this happen:

warning: missing documentation for a constant
 --> src/main.rs:7:5
  |
7 |     const MSG: &str = "Hello, world!";
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_docs_in_private_items
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![warn(clippy::missing_docs_in_private_items)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `missing_docs_in_private_items_detects_const_in_fn` (bin "missing_docs_in_private_items_detects_const_in_fn") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s

Instead, this happened:

No warning.

Version

rustc 1.80.1 (3f5fd8dd4 2024-08-06)
binary: rustc
commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
commit-date: 2024-08-06
host: x86_64-unknown-linux-gnu
release: 1.80.1
LLVM version: 18.1.7

Additional Labels

No response

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
Projects
None yet
1 participant