Skip to content

Commit

Permalink
Update clippy book to mention cfg(clippy) instead of feature `cargo…
Browse files Browse the repository at this point in the history
…-clippy`
  • Loading branch information
GuillaumeGomez committed Feb 14, 2024
1 parent 2a5bc55 commit 7f1e19f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,14 @@ found [here](https://rust-lang.github.io/rust-clippy/master/index.html#msrv)
Very rarely, you may wish to prevent Clippy from evaluating certain sections of code entirely. You can do this with
[conditional compilation](https://doc.rust-lang.org/reference/conditional-compilation.html) by checking that the
`cargo-clippy` feature is not set. You may need to provide a stub so that the code compiles:
`clippy` cfg is not set. You may need to provide a stub so that the code compiles:

```rust
#[cfg(not(feature = "cargo-clippy"))]
#[cfg(not(clippy)]
include!(concat!(env!("OUT_DIR"), "/my_big_function-generated.rs"));

#[cfg(feature = "cargo-clippy")]
#[cfg(clippy)]
fn my_big_function(_input: &str) -> Option<MyStruct> {
None
}
```

This feature is not actually part of your crate, so specifying `--all-features` to other tools, e.g. `cargo test
--all-features`, will not disable it.

0 comments on commit 7f1e19f

Please sign in to comment.