Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allow-disallowed-*-in-tests configuration items #13790

Open
PaulDance opened this issue Dec 6, 2024 · 0 comments
Open

Add allow-disallowed-*-in-tests configuration items #13790

PaulDance opened this issue Dec 6, 2024 · 0 comments
Labels
A-ui Area: Clippy interface, usage and configuration C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-restriction Lint: Belongs in the restriction lint group

Comments

@PaulDance
Copy link

Description

Dear maintainers,

Whenever using one of the disallowed-* lints, one may only specify what is to be enabled, but very little is provided to conditionally disable. This makes workspace-wide refactors often tedious as one needs to #[allow] or #[expect] each use site of a macro, method, ... in tests (and other non-production modules) when adding a new element to one of these disallowed lists.

In parallel of things like #8477 and #11433, an element that should therefore be both relatively easy and quickly useful to implement would be new configuration items for each of, in order of estimated priority:

  • disallowed_methods
  • disallowed_macros
  • disallowed_types
  • disallowed_names
  • disallowed_script_idents

to allow one to disable the lint under #[cfg(test)] gates, in a fashion as similar as possible to allow-dbg-in-tests or allow-print-in-tests for instance. The name for each could be allow-disallowed-*-in-tests, for example allow-disallowed-macros-in-tests.

Thanks in advance,
Paul.

Version

rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: x86_64-unknown-linux-gnu
release: 1.83.0
LLVM version: 19.1.1

Additional Labels

@rustbot label +C-enhancement +A-ui +L-restriction

@rustbot rustbot added A-ui Area: Clippy interface, usage and configuration C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-restriction Lint: Belongs in the restriction lint group labels Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ui Area: Clippy interface, usage and configuration C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-restriction Lint: Belongs in the restriction lint group
Projects
None yet
Development

No branches or pull requests

2 participants