1 #![warn(clippy::block_in_if_condition_expr)]
2 #![warn(clippy::block_in_if_condition_stmt)]
3 #![allow(unused, clippy::let_and_return)]
4 #![warn(clippy::nonminimal_bool)]
12 macro_rules! blocky_too {
25 fn condition_has_block() -> i32 {
36 fn condition_has_block_with_single_expression() -> i32 {
44 fn predicate<F: FnOnce(T) -> bool, T>(pfn: F, val: T) -> bool {
51 // This is a sneaky case, where the block isn't directly in the condition,
52 // but is actually nside a closure that the condition is using.
53 // The same principle applies -- add some extra expressions to make sure
54 // linter isn't confused by them.
75 fn condition_is_normal() -> i32 {
84 fn closure_without_block() {
85 if predicate(|x| x == 3, 6) {}
88 fn condition_is_unsafe_block() {
91 // this should not warn because the condition is an unsafe block
92 if unsafe { 1u32 == std::mem::transmute(a) } {
93 println!("1u32 == a");
99 fn macro_in_closure() {
100 let option = Some(true);
102 if option.unwrap_or_else(|| unimplemented!()) {
107 fn block_in_assert() {