blob: da3e29d2896622871cd7ca262da9fe1aa11559ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#![allow(unused)]
#![warn(clippy::cfg_not_test)]
fn important_check() {}
fn main() {
// Statement
#[cfg(not(test))]
let answer = 42;
// Expression
#[cfg(not(test))]
important_check();
// Make sure only not(test) are checked, not other attributes
#[cfg(not(foo))]
important_check();
}
#[cfg(not(not(test)))]
struct CfgNotTest;
// Deeply nested `not(test)`
#[cfg(not(test))]
fn foo() {}
#[cfg(all(debug_assertions, not(test)))]
fn bar() {}
#[cfg(not(any(not(debug_assertions), test)))]
fn baz() {}
#[cfg(test)]
mod tests {}
|