@@ -13,12 +13,12 @@ rustc and other tool lints.
13
13
[ motivation ] : #motivation
14
14
15
15
Currently, you can configure lints through
16
- - ` #[<level>(<lint>)] ` or ` #![<level>(<lint>)] ` , like ` #[forbid(unsafe )] `
16
+ - ` #[<level>(<lint>)] ` or ` #![<level>(<lint>)] ` , like ` #[forbid(unsafe_code )] `
17
17
- But this doesn't scale up with additional targets (benches, examples,
18
18
tests) or workspaces
19
- - On the command line, like ` cargo clippy -- --forbid unsafe `
19
+ - On the command line, like ` cargo clippy -- --forbid unsafe_code `
20
20
- This puts the burden on the caller
21
- - Through ` RUSTFLAGS ` , like ` RUSTFLAGS=--forbid=unsafe cargo clippy `
21
+ - Through ` RUSTFLAGS ` , like ` RUSTFLAGS=--forbid=unsafe_code cargo clippy `
22
22
- This puts the burden on the caller
23
23
- In ` .cargo/config.toml ` 's ` target.*.rustflags `
24
24
- This couples you to the running in specific directories and not running in
@@ -41,7 +41,7 @@ See also
41
41
A new ` lints ` table would be added to configure lints:
42
42
``` toml
43
43
[lints .rust ]
44
- unsafe = " forbid"
44
+ unsafe_code = " forbid"
45
45
```
46
46
and ` cargo ` would pass these along as flags to ` rustc ` , ` clippy ` , or other lint tools.
47
47
@@ -52,7 +52,7 @@ This would work with
52
52
workspace = true
53
53
54
54
[workspace .lints .rust ]
55
- unsafe = " forbid"
55
+ unsafe_code = " forbid"
56
56
```
57
57
58
58
## Documentation Updates
@@ -65,13 +65,13 @@ Override the default level of lints from different tools by assigning them to a
65
65
table, for example:
66
66
``` toml
67
67
[lints .rust ]
68
- unsafe = " forbid"
68
+ unsafe_code = " forbid"
69
69
```
70
70
71
71
This is short-hand for:
72
72
``` toml
73
73
[lints .rust ]
74
- unsafe = { level = " forbid" , priority = 0 }
74
+ unsafe_code = { level = " forbid" , priority = 0 }
75
75
```
76
76
77
77
` level ` corresponds to the lint levels in ` rustc ` :
@@ -87,7 +87,7 @@ unsafe = { level = "forbid", priority = 0 }
87
87
88
88
To know which table under ` [lints] ` a particular lint belongs under, it is the part before ` :: ` in the lint
89
89
name. If there isn't a ` :: ` , then the tool is ` rust ` . For example a warning
90
- about ` unsafe ` would be ` lints.rust.unsafe ` but a lint about
90
+ about ` unsafe_code ` would be ` lints.rust.unsafe_code ` but a lint about
91
91
` clippy::enum_glob_use ` would be ` lints.clippy.enum_glob_use ` .
92
92
93
93
## The ` lints ` table
@@ -106,7 +106,7 @@ Example:
106
106
members = [" crates/*" ]
107
107
108
108
[workspace .lints .rust ]
109
- unsafe = " forbid"
109
+ unsafe_code = " forbid"
110
110
```
111
111
112
112
``` toml
0 commit comments