Void Return
ID |
swift.void_return |
Severity |
info |
Remediation Complexity |
medium |
Remediation Risk |
low |
Remediation Effort |
medium |
Resource |
Code Smell |
Language |
Swift |
Tags |
code-smell, style |
Description
Reports an explicit → Void or → () return clause on a function
declaration. Both forms are equivalent to declaring no return type at
all, and Swift’s convention is to drop them.
func tick() -> Void { ... } // FLAW
func tick() -> () { ... } // FLAW
func tick() { ... } // OK
func count() -> Int { ... } // OK
Rationale
→ Void and → () say the same thing as the empty default return
type. The Swift API Design Guidelines and the standard library
consistently omit them, so leaving them in code signals either
unfamiliarity with the convention or a literal port from another
language. Cleaning them up keeps signatures uniform.