You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently closures can be written one of two ways: myCollection.filter{ $0 == 1 }
or myCollection.filter({ $0 == 1 })
These two different ways are identical and will run exactly the same way. Further more, this also extends to closures with multiple lines:
let newCollection = myCollection.map{
2*$0 + 5
}
or
let newCollection = myCollection.map({
2*$0 + 5
})
For this, I propose a new rule which allows the presence of parentheses to be required, or disallowed depending on the configuration. Furthermore, I think the rule should allow you to differentiate between inline closures and multi line closures. For instance, with a particular configuration this would be allowed:
Currently closures can be written one of two ways:
myCollection.filter{ $0 == 1 }
or
myCollection.filter({ $0 == 1 })
These two different ways are identical and will run exactly the same way. Further more, this also extends to closures with multiple lines:
or
For this, I propose a new rule which allows the presence of parentheses to be required, or disallowed depending on the configuration. Furthermore, I think the rule should allow you to differentiate between inline closures and multi line closures. For instance, with a particular configuration this would be allowed:
The text was updated successfully, but these errors were encountered: