fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// run-rustfix 2 3#![feature(let_chains)] 4#![allow(unused_variables)] 5#![allow(dead_code)] 6#![allow(irrefutable_let_patterns)] 7 8fn err_some(b: bool, x: Option<u32>) { 9 if b && let Some(x) = x {} 10 //~^ ERROR unexpected `if` in the condition expression 11} 12 13fn err_none(b: bool, x: Option<u32>) { 14 if b && let None = x {} 15 //~^ ERROR unexpected `if` in the condition expression 16} 17 18fn err_bool_1() { 19 if true && true { true } else { false }; 20 //~^ ERROR unexpected `if` in the condition expression 21} 22 23fn err_bool_2() { 24 if true && false { true } else { false }; 25 //~^ ERROR unexpected `if` in the condition expression 26} 27 28fn should_ok_1() { 29 if true && if let x = 1 { true } else { true } {} 30} 31 32fn should_ok_2() { 33 if true && if let 1 = 1 { true } else { true } {} 34} 35 36fn should_ok_3() { 37 if true && if true { true } else { false } {} 38} 39 40fn shoule_match_ok() { 41 #[cfg(feature = "full")] 42 { 43 let a = 1; 44 let b = 2; 45 if match a { 46 1 if b == 1 => true, 47 _ => false, 48 } && if a > 1 { true } else { false } 49 { 50 true 51 } 52 } 53} 54 55fn should_ok_in_nested() { 56 if true && if true { true } else { false } { true } else { false }; 57} 58 59fn main() {}