1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-16 06:10:26 +02:00

Allow the 'unused' category of lints (#2571)

These sort of warnings can be distracting when commenting out a few
lines of code or demonstrating some other concept. They can be
re-enabled for a code block with `warnunused`.

I filed https://github.com/rust-lang/mdBook/issues/2527 to get behavior
like this upstream.
This commit is contained in:
Dustin J. Mitchell
2025-01-20 12:47:50 -05:00
committed by GitHub
parent 9fa1b645be
commit 5f7e0c3f64
4 changed files with 16 additions and 11 deletions

View File

@ -8,10 +8,10 @@ The Rust compiler produces fantastic error messages, as well as helpful built-in
lints. [Clippy](https://doc.rust-lang.org/clippy/) provides even more lints,
organized into groups that can be enabled per-project.
```rust,editable,should_panic
```rust,editable,should_panic,warnunused
#[deny(clippy::cast_possible_truncation)]
fn main() {
let x = 3;
let mut x = 3;
while (x < 70000) {
x *= 2;
}
@ -21,13 +21,9 @@ fn main() {
<details>
Run the code sample and examine the error message. There are also lints visible
here, but those will not be shown once the code compiles. Switch to the
Playground site to show those lints.
After resolving the lints, run `clippy` on the playground site to show clippy
warnings. Clippy has extensive documentation of its lints, and adds new lints
(including default-deny lints) all the time.
There are compiler lints visible here, but not clippy lints. Run `clippy` on the
playground site to show clippy warnings. Clippy has extensive documentation of
its lints, and adds new lints (including default-deny lints) all the time.
Note that errors or warnings with `help: ...` can be fixed with `cargo fix` or
via your editor.