Skip to content

New lint category: panics #15049

Open
Open
@nik-rev

Description

@nik-rev

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

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