rust-lang / rust-lang/rust-clippy

Per-path lint levels in `DisallowedPath`

Open
#11,307 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

G-Rust-for-Linux
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

DisallowedPath could gain support for different lint levels for particular paths.

The use case is that a project may want to warn, deny or forbid depending on the method/macro/type/name/... in particular. For instance, a project may want to deny a custom panicking macro and warn about some debugging macros. Assuming -Wdisallowed_macros, they could write:

disallowed-macros = [
    "x::dbg",
    { path = "x::panic", level = "deny" },
]

These could behave as their own lint for level purposes. However, someone may still want to be able to override them, e.g. to allow or deny all of them, or a few of them. Thus it may be nice to give the user the ability to do so with e.g. -Ddisallowed_macros=x::dbg_foo and -Ddisallowed_macros=* (all, i.e. including both the ones with an explicit level and those without it, since the usual -Ddisallowed_macros applies to the current ones, i.e. those without an explicit level).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the DisallowedPath implementation and the existing lint-level handling for disallowed macros. Compare how explicit per-path levels and command-line overrides would interact, then identify the relevant tests or entry points from that implementation. Done means the proposed path-specific levels and override behavior are specified and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.