blob: f695f9804d59cada1c6d44d2e9a744d5e0b5a803 (
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
|
#![allow(clippy::eq_op, clippy::nonminimal_bool)]
#[rustfmt::skip]
#[warn(clippy::collapsible_if)]
fn main() {
let (x, y) = ("hello", "world");
if x == "hello"
// Comment must be kept
&& y == "world" {
println!("Hello world!");
}
//~^^^^^^ collapsible_if
// The following tests check for the fix of https://github.com/rust-lang/rust-clippy/issues/798
if x == "hello" // Inner comment
&& y == "world" {
println!("Hello world!");
}
//~^^^^^ collapsible_if
if x == "hello"
/* Inner comment */
&& y == "world" {
println!("Hello world!");
}
//~^^^^^^ collapsible_if
if x == "hello" /* Inner comment */
&& y == "world" {
println!("Hello world!");
}
//~^^^^^ collapsible_if
}
|