2023-06-10 06:43:30 -05:00
|
|
|
#![allow(clippy::assertions_on_constants, clippy::equatable_if_let, clippy::needless_if)]
|
2024-08-24 12:43:34 -05:00
|
|
|
#![warn(clippy::collapsible_if, clippy::collapsible_else_if)]
|
2020-01-07 00:06:23 -06:00
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
fn main() {
|
|
|
|
let x = "hello";
|
|
|
|
let y = "world";
|
|
|
|
// Collapse `else { if .. }` to `else if ..`
|
|
|
|
if x == "hello" {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
if y == "world" {
|
|
|
|
println!("world!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if x == "hello" {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
if let Some(42) = Some(42) {
|
|
|
|
println!("world!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if x == "hello" {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
if y == "world" {
|
|
|
|
println!("world")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
println!("!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if x == "hello" {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
if let Some(42) = Some(42) {
|
|
|
|
println!("world")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
println!("!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(42) = Some(42) {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
if let Some(42) = Some(42) {
|
|
|
|
println!("world")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
println!("!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(42) = Some(42) {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
if x == "hello" {
|
|
|
|
println!("world")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
println!("!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(42) = Some(42) {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
if let Some(42) = Some(42) {
|
|
|
|
println!("world")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
println!("!")
|
|
|
|
}
|
|
|
|
}
|
2021-02-08 11:00:30 -06:00
|
|
|
|
|
|
|
if x == "hello" {
|
|
|
|
print!("Hello ");
|
|
|
|
} else {
|
|
|
|
#[cfg(not(roflol))]
|
|
|
|
if y == "world" {
|
|
|
|
println!("world!")
|
|
|
|
}
|
|
|
|
}
|
2020-01-07 00:06:23 -06:00
|
|
|
}
|
2022-04-21 12:42:55 -05:00
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
fn issue_7318() {
|
|
|
|
if true { println!("I've been resolved!")
|
|
|
|
}else{
|
|
|
|
if false {}
|
|
|
|
}
|
|
|
|
}
|