Skip to content

CLIPPY_FLAGS to pass options to clippy/ enable disable lints via env vars #5214

Closed
@matthiaskrgr

Description

@matthiaskrgr

Right now, there is no way to globally enable/disable clippy lints on a system.
If we want to disable certain lint, we have to either modify the code and add #[allow(clippy::foo)] which is tedious, or we have to add -- -Aclippy::foo to EVERY clippy invocation which is also tedious and not always easily done, especially if clippy is invoked by another tool.

IMO the biggest problem is that we cannot use RUSTFLAGS for some reason:
RUSTFLAGS="-Aclippy::needless_return" cargo clippy will just throw errors:

error[E0602]: unknown lint: `clippy::needless_return`
  |
  = note: requested on the command line with `-A clippy::needless_return`

I would love to have something like
export CLIPPY_FLAGS="-A collapsible_if that I just throw into my zshrc and stop worrying about that lint forever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-needs-discussionStatus: Needs further discussion before merging or work can be started

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions