rust-lang / rust-lang/rust-clippy
Separate `check-private-items` configuration for different lints
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
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:
check-private-items-missing-panics-doccheck-private-items-missing-safety-doc- ... possibly more
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how check-private-items is handled for the missing_panics_doc and missing_safety_doc lints. Determine how per-lint configuration should override the shared option, then verify that the proposed settings distinguish private safety documentation from private panic documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100