Separate check-private-items configuration for different lints · Issue #13074 · rust-lang/rust-clippy (original) (raw)

Description

Issue

check-private-items currently controls behavior of multiple lints, e.g. missing_panics_doc and missing_safety_doc.

However, I would like to check even private items for safety docs but I don't care as much about panics. Especially since we also lint tests where I often use panics.

Proposal

Add more fine-grained options which can override check-private-items:

Then clippy.toml such as

check-private-items = false
check-private-items-missing-safety-doc = true

would work like this:

#![warn(missing_panics_doc)]
#![warn(missing_safety_doc)]

// This would be warned against because of `missing_safety_doc`
unsafe fn private_unsafe_fun() {}

// This would be warned against because of `missing_panics_doc`
pub fn public_panicking_fun() { panic!(); }

// This would not be warned against because it's a panic inside a private function
fn private_panicking_fun() { panic!(); }

Version

No response

Additional Labels

@rustbot label +C-enhancement