Skip to content

Commit 3a34bc0

Browse files
committed
Auto merge of rust-lang#6270 - ClashTheBunny:clarify_allow_deny_enable_disable, r=flip1995
Clarify allow/warn/deny documentation. Remove enable/disable. Disable and enable when not specifically explained were not clear to me as an English language speaker, but I was able to figure it out fairly easily due to the examples having A/W, which I assumed meant `allow` and `warn`. I removed both words to be sure it was clear as well as extending the note on what deny means. It now includes a statement on exactly what each word means. Documentation only update. *Please keep the line below* changelog: none
2 parents 225ce5f + cf2043d commit 3a34bc0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,21 @@ You can add options to your code to `allow`/`warn`/`deny` Clippy lints:
167167

168168
* `allow`/`warn`/`deny` can be limited to a single function or module using `#[allow(...)]`, etc.
169169

170-
Note: `deny` produces errors instead of warnings.
170+
Note: `allow` means to suppress the lint for your code. With `warn` the lint
171+
will only emit a warning, while with `deny` the lint will emit an error, when
172+
triggering for your code. An error causes clippy to exit with an error code, so
173+
is useful in scripts like CI/CD.
171174

172-
If you do not want to include your lint levels in your code, you can globally enable/disable lints
173-
by passing extra flags to Clippy during the run:
175+
If you do not want to include your lint levels in your code, you can globally
176+
enable/disable lints by passing extra flags to Clippy during the run:
174177

175-
To disable `lint_name`, run
178+
To allow `lint_name`, run
176179

177180
```terminal
178181
cargo clippy -- -A clippy::lint_name
179182
```
180183

181-
And to enable `lint_name`, run
184+
And to warn on `lint_name`, run
182185

183186
```terminal
184187
cargo clippy -- -W clippy::lint_name
@@ -190,7 +193,7 @@ can run Clippy with warnings for all lints enabled:
190193
cargo clippy -- -W clippy::pedantic
191194
```
192195

193-
If you care only about a single lint, you can allow all others and then explicitly reenable
196+
If you care only about a single lint, you can allow all others and then explicitly warn on
194197
the lint(s) you are interested in:
195198
```terminal
196199
cargo clippy -- -A clippy::all -W clippy::useless_format -W clippy::...

0 commit comments

Comments
 (0)