Open jshier opened 1 month ago
It could make sense to support this as an option in the propertyType
rule. Agreed this would be a good addition.
A similar example related to literals is:
let width: Double = 10
// vs
let width = Double(10)
@calda it was at one point recommended not to use Double(0)
because it's not merely an alternative syntax for casting; it actually incurs an additional runtime cost:
I've no idea if that's still the case now though. In any case the cost is presumably trivial.
If you did want to that, it should probably be a separate setting or a configuration option separate from the collection values.
Barring other considerations, these two forms mean the same thing for
Array
andSet
:I don't see a rule to allow preferring the first form over the second, is it possible?