Skip to content

Commit

Permalink
Clarify allow/warn/deny. Remove enable/disable.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ClashTheBunny committed Oct 30, 2020
1 parent 0be6544 commit 9f402c9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions README.md
Expand Up @@ -167,18 +167,22 @@ You can add options to your code to `allow`/`warn`/`deny` Clippy lints:

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

Note: `deny` produces errors instead of warnings.
Note: `allow` in this case means to "allow your code to have the lint without
warning". `deny` means "produce an error if your code has the lint". `warn`
means "produce a warning, but don't produce an error due to this lint". An
error causes clippy to exit with an error code, so is useful in scripts like
CI/CD.

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

To disable `lint_name`, run
To allow `lint_name`, run

```terminal
cargo clippy -- -A clippy::lint_name
```

And to enable `lint_name`, run
And to warn on `lint_name`, run

```terminal
cargo clippy -- -W clippy::lint_name
Expand All @@ -190,7 +194,7 @@ can run Clippy with warnings for all lints enabled:
cargo clippy -- -W clippy::pedantic
```

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

0 comments on commit 9f402c9

Please sign in to comment.