rust-lang / rust-lang/rust-clippy

Ability to `#[allow(clippy::disallowed_methods)]` for a single method

Open
#8,477 0 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.