Redundant Void Return
Returning Void in a function declaration is redundant
- Identifier: redundant_void_return
- Enabled by default: Yes
- Supports autocorrection: Yes
- Kind: idiomatic
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
func foo() {}
func foo() -> Int {}
func foo() -> Int -> Void {}
func foo() -> VoidResponse
let foo: (Int) -> Void
func foo() -> Int -> () {}
let foo: (Int) -> ()
func foo() -> ()?
func foo() -> ()!
func foo() -> Void?
func foo() -> Void!
struct A {
subscript(key: String) {
print(key)
}
}
Triggering Examples
func foo()↓ -> Void {}
protocol Foo {
func foo()↓ -> Void
}
func foo()↓ -> () {}
func foo()↓ -> ( ) {}
protocol Foo {
func foo()↓ -> ()
}