Skip to content

Per-path lint levels in DisallowedPath #11307

Open
@ojeda

Description

@ojeda

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions