Skip to content

New Lint: blacklisted_method #6073

Closed
@ilknarf

Description

@ilknarf

What it does

Blacklist Method Disallowed Method (see #5896)
What does this lint do?
Disallows certain methods, as defined in clippy.toml

Categories (optional)

  • Kind: Nursery

Checks for method calls of specified methods
For example:

  • SomeStruct::bad_method
  • SomeTrait::bad_method

Drawbacks

This might take some significant overhead to implement (regex or some manual string parsing), and the main purpose would probably be to patch in temporary lints, so it might not be super useful.

Example

# clippy.toml

disallowed-methods = ["Foo::bar", "Baz::bar"]
...
let f = Foo::default();
f.bar();
...

results in a lint

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions