@nicklockwood I found some weird behaviour around multi-line guard statements. Here's my test example:
class MyClass {
struct MyStruct {
private func doSomething() {
guard let foo = blah,
bar.isSomething else {
doSomething()
}
}
}
}
Running the following command:
$ Pods/SwiftFormat/CommandLineTool/swiftformat test.swift --rules elseOnSameLine,wrapMultilineStatementBraces
Expected outcome:
class MyClass {
struct MyStruct {
private func doSomething() {
guard let foo = blah,
bar.isSomething
else {
doSomething()
}
}
}
}
Actual outcome:
class MyClass {
struct MyStruct {
private func doSomething() {
guard let foo = blah,
bar.isSomething
else {
doSomething()
}
}
}
}
@meherkasam thanks for reporting, I'll get it fixed asap.
I think this was probably masked in testing by the fact the indent rule normally fixes it automatically.
Yup, you're right!
Running the following command works fine:
$ Pods/SwiftFormat/CommandLineTool/swiftformat test.swift --rules elseOnSameLine,wrapMultilineStatementBraces,indent
I didn't have the indent rule turned on yet.
@meherkasam fixed in 0.45.4.