about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-26 20:55:53 +0000
committerbors <bors@rust-lang.org>2020-09-26 20:55:53 +0000
commitea079eb8a4ad3b7ccdfd102bbbd722bf0a203378 (patch)
tree7b7b7b4755af984de2079908b8e017b375930676 /src
parentb64d21d9805577daa098c88811531ac2564fde07 (diff)
parent5f7b6437587bb0eda69c754ff52f92ed6eba2d72 (diff)
downloadrust-ea079eb8a4ad3b7ccdfd102bbbd722bf0a203378.tar.gz
rust-ea079eb8a4ad3b7ccdfd102bbbd722bf0a203378.zip
Auto merge of #6081 - ilknarf:master, r=matthiaskrgr
New Lint: disallowed_method

Fixes https://github.com/rust-lang/rust-clippy/issues/6073

I added a `disallowed_method` lint that works similar to `blacklisted_name`, e.g allows config-defined disallowed method calls.

This lint allows advanced users to patch in undesired method calls for specific projects. It basically uses the DefId of method calls and matches it to parsed strings. Is there an alternative approach that could use more easily digestible configuration strings?

All tests pass as expected except for a linting error on `ui/redundant_pattern_matching_option`, which I am not sure how to resolve since I don't think I changed anything affecting it.

changelog: Add disallowed_method lint to warn on user-defined method calls
Diffstat (limited to 'src')
-rw-r--r--src/lintlist/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index 9603023ed06..76e655ad603 100644
--- a/src/lintlist/mod.rs
+++ b/src/lintlist/mod.rs
@@ -382,6 +382,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
         module: "derive",
     },
     Lint {
+        name: "disallowed_method",
+        group: "nursery",
+        desc: "use of a disallowed method call",
+        deprecation: None,
+        module: "disallowed_method",
+    },
+    Lint {
         name: "diverging_sub_expression",
         group: "complexity",
         desc: "whether an expression contains a diverging sub expression",