Thanks for the SwiftFormat, guys! The tool is cool, but today i ran into a bug. redundantReturn rule deletes return statement unexpectedly when it's following by a switch-case statement. Check this out please :)
enum DeveloperLifeCycle {
case eating
case sleeping
case coding
}
func swiftFormatBug() -> DeveloperLifeCycle {
// And we want to hardcode a value for a test...
return .coding
// Suppose we have switch-case with return statement inside...
let state = DeveloperLifeCycle.coding
switch state {
case .eating, .sleeping, .coding:
return state
}
}
Hi!
Thanks for the SwiftFormat, guys! The tool is cool, but today i ran into a bug.
redundantReturn
rule deletesreturn
statement unexpectedly when it's following by aswitch-case
statement. Check this out please :)Video example:
https://github.com/nicklockwood/SwiftFormat/assets/68778381/98a413af-66c5-4034-9d60-a07e12ecaaa9
Code example: