From 9b00f4185eb123a1276305d51395b51845c3631a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Thu, 30 Jul 2020 16:51:10 +0200 Subject: [PATCH] Make `run` return `Never` If an API method is designed to never return, it should be marked as returning `Never`. This way Swift will warn you if you add code after a call to such a method. --- Sources/AWSLambdaRuntime/Lambda+Codable.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/AWSLambdaRuntime/Lambda+Codable.swift b/Sources/AWSLambdaRuntime/Lambda+Codable.swift index 6173b0d2..c4e47c13 100644 --- a/Sources/AWSLambdaRuntime/Lambda+Codable.swift +++ b/Sources/AWSLambdaRuntime/Lambda+Codable.swift @@ -29,7 +29,7 @@ extension Lambda { /// - closure: `CodableClosure` based Lambda. /// /// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine. - public static func run(_ closure: @escaping CodableClosure) { + public static func run(_ closure: @escaping CodableClosure) -> Never { self.run(CodableClosureWrapper(closure)) } @@ -42,7 +42,7 @@ extension Lambda { /// - closure: `CodableVoidClosure` based Lambda. /// /// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine. - public static func run(_ closure: @escaping CodableVoidClosure) { + public static func run(_ closure: @escaping CodableVoidClosure) -> Never { self.run(CodableVoidClosureWrapper(closure)) } }