// inside a closure that the condition is using. same principle applies. add some extra
// expressions to make sure linter isn't confused by them.
if v == 3 && sky == "blue" && predicate(|x| { let target = 3; x == target }, v) {
-
}
if predicate(|x| { let target = 3; x == target }, v) {
-
}
-
}
fn condition_is_normal() -> i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let'
- --> $DIR/block_in_if_condition.rs:62:22
+ --> $DIR/block_in_if_condition.rs:61:22
|
-62 | if predicate(|x| { let target = 3; x == target }, v) {
+61 | if predicate(|x| { let target = 3; x == target }, v) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: this boolean expression can be simplified
- --> $DIR/block_in_if_condition.rs:70:8
+ --> $DIR/block_in_if_condition.rs:67:8
|
-70 | if true && x == 3 {
+67 | if true && x == 3 {
| ^^^^^^^^^^^^^^ help: try `x == 3`
|
note: lint level defined here