4 #![warn(block_in_if_condition_expr)]
5 #![warn(block_in_if_condition_stmt)]
6 #![allow(unused, let_and_return)]
7 #![warn(nonminimal_bool)]
14 macro_rules! blocky_too {
29 fn condition_has_block() -> i32 {
40 fn condition_has_block_with_single_expression() -> i32 {
48 fn predicate<F: FnOnce(T) -> bool, T>(pfn: F, val:T) -> bool {
55 // this is a sneaky case, where the block isn't directly in the condition, but is actually
56 // inside a closure that the condition is using. same principle applies. add some extra
57 // expressions to make sure linter isn't confused by them.
58 if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) {
61 if predicate(|x| { let target = 3; x == target }, v) {
65 fn condition_is_normal() -> i32 {
74 fn closure_without_block() {
75 if predicate(|x| x == 3, 6) {
80 fn condition_is_unsafe_block() {
83 // this should not warn because the condition is an unsafe block
84 if unsafe { 1u32 == std::mem::transmute(a) } {
85 println!("1u32 == a");