Pattern: Missing use of implicit return
Issue: -
Prefer implicit returns in closures.
Examples of correct code:
foo.map { $0 + 1 }
foo.map({ $0 + 1 })
foo.map { value in value + 1 }
func foo() -> Int {
return 0
}
if foo {
return 0
}
var foo: Bool { return true }
Examples of incorrect code:
foo.map { value in
↓return value + 1
}
foo.map {
↓return $0 + 1
}