Skip to content

Separate check-private-items configuration for different lints #13074

@mladedav

Description

@mladedav

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-doc
  • check-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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions