Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@ That includes warnings found by rustc (e.g. `dead_code`, etc.). If you want to a
an error for Clippy warnings, use `#![deny(clippy::all)]` in your code or `-D clippy::all` on the command
line. (You can swap `clippy::all` with the specific lint category you are targeting.)

Alternatively, since Cargo 1.97, you can use the [`build.warnings`] config option:

```toml
# .cargo/config.toml
[build]
warnings = "deny"
```

Or via environment variable:

```bash
CARGO_BUILD_WARNINGS=deny cargo clippy
```

Unlike `-Dwarnings`, this does not invalidate build caches and only affects lint warnings.

[`build.warnings`]: https://doc.rust-lang.org/cargo/reference/config.html#buildwarnings

## Configuration

### Allowing/denying lints
Expand Down
18 changes: 18 additions & 0 deletions book/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ cargo clippy -- -Dwarnings
> are found in your code. That includes warnings found by rustc (e.g.
> `dead_code`, etc.).

Alternatively, since Cargo 1.97, you can use the [`build.warnings`] config option:

```toml
# .cargo/config.toml
[build]
warnings = "deny"
```

Or via environment variable:

```bash
CARGO_BUILD_WARNINGS=deny cargo clippy
```

Unlike `-Dwarnings`, this does not invalidate build caches and only affects lint warnings.

[`build.warnings`]: https://doc.rust-lang.org/cargo/reference/config.html#buildwarnings

For more information on configuring lint levels, see the [rustc documentation].

[rustc documentation]: https://doc.rust-lang.org/rustc/lints/levels.html#configuring-warning-levels
Expand Down
Loading