Open zienag opened 11 months ago
This is a know issue. Per the README:
The redundantVoidReturnType rule can inadvertently alter the type signature for closures, for example in cases where the closure calls a @discardableResult function. To solve this you can either fix it on a per-case basis by adding a // swiftformat:disable:next redundantVoidReturnType comment directive to disable the rule for a specific call site, or you can add --closurevoid preserve to your configuration to disable the rule completely for closures (regular functions or methods aren't affected).
Hi! Just updated to new version of swiftformat, and faced a small problem. Given some closure, that consists of single assigning expression that has optional chaining on left hand side, compiler inferes that closure of type
() -> Void?
. To fix it, explicitVoid
is needed, but swiftformat deletes it.Maybe swift format can check for optional chaining on lhs of assign in that case?