rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

New lint category: `panics`

Open nik-rev opened this issue 6 months ago • 0 comments

Description

I propose to move these lints from restriction into a new allow-by-default category panics. This category contains lints that are related to preventing panics somehow:

  • expect_used
  • unwrap_used
  • panic
  • unreachable
  • unimplemented
  • todo
  • indexing_slicing

Projects that wish to minimize the amount of panics from their codebase have to enable each of the above lints. It would be simpler for them to instead just configure the panic category:

[lints.clippy]
panics = "deny"

Note: Why call it panics and not panic:

  1. Clippy already has a panic lint so it will clash
  2. Projects that have panic = "deny" will experience all of the above lints being auto-enabled for them when they migrate to a clippy version that has this change

Additional Labels

@rustbot label +C-enhancement

nik-rev avatar Jun 13 '25 16:06 nik-rev