1 #![warn(clippy::blocks_in_if_conditions)]
2 #![allow(unused, clippy::let_and_return)]
4 fn predicate<F: FnOnce(T) -> bool, T>(pfn: F, val: T) -> bool {
11 // This is a sneaky case, where the block isn't directly in the condition,
12 // but is actually inside a closure that the condition is using.
13 // The same principle applies -- add some extra expressions to make sure
14 // linter isn't confused by them.
35 fn closure_without_block() {
36 if predicate(|x| x == 3, 6) {}
39 fn macro_in_closure() {
40 let option = Some(true);
42 if option.unwrap_or_else(|| unimplemented!()) {
47 fn closure(_: impl FnMut()) -> bool {
51 fn function_with_empty_closure() {
57 let mut range = 0..10;
58 range.all(|i| {i < 10} );
60 let v = vec![1, 2, 3];
61 if v.into_iter().any(|x| {x == 4}) {
62 println!("contains 4!");