rust-lang / rust-lang/rust-clippy
Ability to `#[allow(clippy::disallowed_methods)]` for a single method
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Description
The warning looks like this
= note: `#[warn(clippy::disallowed_methods)]` on by default
If you have several disallowed methods, but you want to allow them in a handful of places, you can use
#[allow(clippy::disallowed_methods)].
Would like to be able to allow a single method, say at a module or crate level.
One idea might be to have the warning look more like
#[warn(clippy::disallowed_methods::std::time::Duration)] - such that it can be allowed on a more granular basis.
Version
rustc 1.60.0-nightly (1e12aef3f 2022-02-13)
binary: rustc
commit-hash: 1e12aef3fab243407f9d71ba9956cb2a1bf105d5
commit-date: 2022-02-13
host: aarch64-apple-darwin
release: 1.60.0-nightly
LLVM version: 13.0.0
Additional Labels
@rustbot label +C-enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the implementation and tests for the clippy::disallowed_methods lint. Review how its warning and lint attributes are currently handled, then determine the smallest supported scope for allowing an individual method. Done means the granular allowance works at the requested module or crate scope and is 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