blob: 240b79bae13c20905839c8c7c6c096d081aece3b (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#![allow(unused)]
#![warn(clippy::needless_else)]
#![allow(clippy::suspicious_else_formatting)]
macro_rules! mac {
($test:expr) => {
if $test {
println!("Test successful!");
} else {
}
};
}
macro_rules! empty_expansion {
() => {};
}
fn main() {
let b = std::hint::black_box(true);
if b {
println!("Foobar");
}
if b {
println!("Foobar");
} else {
// Do not lint because this comment might be important
}
if b {
println!("Foobar");
} else
/* Do not lint because this comment might be important */
{
}
// Do not lint because of the expression
let _ = if b { 1 } else { 2 };
// Do not lint because inside a macro
mac!(b);
if b {
println!("Foobar");
} else {
#[cfg(foo)]
"Do not lint cfg'd out code"
}
if b {
println!("Foobar");
} else {
empty_expansion!();
}
}
|