summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/disallowed_types.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/disallowed_types.txt')
-rw-r--r--src/tools/clippy/src/docs/disallowed_types.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/disallowed_types.txt b/src/tools/clippy/src/docs/disallowed_types.txt
new file mode 100644
index 000000000..2bcbcddee
--- /dev/null
+++ b/src/tools/clippy/src/docs/disallowed_types.txt
@@ -0,0 +1,33 @@
+### What it does
+Denies the configured types in clippy.toml.
+
+Note: Even though this lint is warn-by-default, it will only trigger if
+types are defined in the clippy.toml file.
+
+### Why is this bad?
+Some types are undesirable in certain contexts.
+
+### Example:
+An example clippy.toml configuration:
+```
+disallowed-types = [
+ # Can use a string as the path of the disallowed type.
+ "std::collections::BTreeMap",
+ # Can also use an inline table with a `path` key.
+ { path = "std::net::TcpListener" },
+ # When using an inline table, can add a `reason` for why the type
+ # is disallowed.
+ { path = "std::net::Ipv4Addr", reason = "no IPv4 allowed" },
+]
+```
+
+```
+use std::collections::BTreeMap;
+// or its use
+let x = std::collections::BTreeMap::new();
+```
+Use instead:
+```
+// A similar type that is allowed by the config
+use std::collections::HashMap;
+``` \ No newline at end of file