Closed oslo-slin closed 2 weeks ago
Do you specify a --swiftversion
in the config file? This functionality was added in Swift 5.7 so is only enabled if a --swiftversion
of 5.7 or later is specified.
I tested the sample code you shared with redundantOptionalBinding
enabled and --swiftversion 5.7
, and it removed the redundant = self
as expected.
@calda Thanks for getting back to this thread. Specifying the minimum minor version of Swift 5.7 was indeed the key to enforce redundant optional binding, resolving / closing this issue. Appreciate your help!
Hello,
Wanted to post and see if anyone has encountered any similar issues. In the current project's codebase I'm working on, we have been using
guard let self = self else { return }
as a statement to capture weak self for optional binding purposes. Using the latest patch 0.54.0, it seems like SwiftFormat isn't able to capture such statement.Attaching a code snippet of the actual piece
We have been using a configuration file as the approach to specify rules, the below is what the current set up:
Thanks in advance if you'd be able to get to it, appreciate your time!