blob: d93e16f3b1855c1b8dd2240c395a02915a7701f2 (
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
33
34
35
36
37
|
#![allow(unused)]
#![warn(clippy::cfg_not_test)]
fn important_check() {}
fn main() {
// Statement
#[cfg(not(test))]
//~^ cfg_not_test
let answer = 42;
// Expression
#[cfg(not(test))]
//~^ 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))]
//~^ cfg_not_test
fn foo() {}
#[cfg(all(debug_assertions, not(test)))]
//~^ cfg_not_test
fn bar() {}
#[cfg(not(any(not(debug_assertions), test)))]
//~^ cfg_not_test
fn baz() {}
#[cfg(test)]
mod tests {}
|