blob: 2bcbcddee5666d10d749568713f34c185e057afb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
```
|