SwiftFormat icon indicating copy to clipboard operation
SwiftFormat copied to clipboard

unusedPrivateDeclarations Deleting private funcs in extensions

Open Megatron1000 opened this issue 1 year ago • 1 comments

Say you've got this

class MyClass {
   func doSomething() {
      doTheThing()
   }
}

extension MyClass {
   private func doTheThing() {
   }
}

doTheThing will be deleted for being unused. I guess it's just checking if it's used within the extension itself.

Megatron1000 avatar Dec 09 '24 23:12 Megatron1000

When I test the unusedPrivateDeclarations rule with this sample code, the private func doTheThing() is not removed (the rule correctly notices that the doTheThing method is not unused).

calda avatar Dec 09 '24 23:12 calda