Closed marcelofabri closed 2 months ago
There's currently not really a way for SwiftFormat to detect this case since it doesn't have access to type information. The best option for now would be to disable the rule, either globally or locally using:
// swiftformat:disable:next redundantInit
let a = Module.configuration.loggingEventBatchType.init(
anyEvents: eventsToUpload
)
@marcelofabri I realized on reflection that the existing heuristic I use to avoid false positives for redundantInit
ought to handle this case as well, so I've pushed a fix to develop that should solve it
@marcelofabri fixed in 0.53.7
Given this code:
0.53.6
removes the.init
, causing an error:loggingEventBatchType
is defined asAnyLoggingEventBatch.Type