From d1cacdd4b6fbbf25e91b4725d43ab0b4deb87616 Mon Sep 17 00:00:00 2001 From: Julian Locke Date: Tue, 1 Oct 2024 17:00:43 -0400 Subject: [PATCH] Fix swift warnings --- .../swift_rsrc/SwiftObjcShimHelpers.jinja | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/stone/backends/swift_rsrc/SwiftObjcShimHelpers.jinja b/stone/backends/swift_rsrc/SwiftObjcShimHelpers.jinja index 739ec802..2026d3b9 100644 --- a/stone/backends/swift_rsrc/SwiftObjcShimHelpers.jinja +++ b/stone/backends/swift_rsrc/SwiftObjcShimHelpers.jinja @@ -101,7 +101,7 @@ private func callErrorToDB(error: DBXCallError?) -> DBRequestError? { if let lum = error.localizedUserMessage { localizedUserMessage = DBLocalizedUserMessage(text: lum.text, locale: lum.locale) } - var structuredAuthError: DBAUTHAuthError = { + let structuredAuthError: DBAUTHAuthError = { if error.error.asInvalidAccessToken != nil { return DBAUTHAuthError(invalidAccessToken: ()) } else if error.error.asInvalidSelectUser != nil { @@ -134,31 +134,30 @@ private func callErrorToDB(error: DBXCallError?) -> DBRequestError? { if let lum = error.localizedUserMessage { localizedUserMessage = DBLocalizedUserMessage(text: lum.text, locale: lum.locale) } - var structuredAccessError: DBAUTHAccessError = { + let structuredAccessError: DBAUTHAccessError = { if let error = error.error.asInvalidAccountType { let accountTypeError: DBAUTHInvalidAccountTypeError = { - if let error = error.invalidAccountType.asFeature { + if error.invalidAccountType.asFeature != nil { return DBAUTHInvalidAccountTypeError(feature: ()) - } else if let error = error.invalidAccountType.asEndpoint { + } else if error.invalidAccountType.asEndpoint != nil { return DBAUTHInvalidAccountTypeError(endpoint: ()) } else { return DBAUTHInvalidAccountTypeError(other: ()) } }() - return DBAUTHAccessError(invalidAccountType: accountTypeError) } else if let error = error.error.asPaperAccessDenied { let paperAccessError: DBAUTHPaperAccessError = { - if let error = error.paperAccessDenied.asNotPaperUser { + if error.paperAccessDenied.asNotPaperUser != nil { return DBAUTHPaperAccessError(notPaperUser: ()) - } else if let error = error.paperAccessDenied.asPaperDisabled { + } else if error.paperAccessDenied.asPaperDisabled != nil { return DBAUTHPaperAccessError(paperDisabled: ()) } else { return DBAUTHPaperAccessError(other: ()) } }() return DBAUTHAccessError(paperAccessDenied: paperAccessError) - } else if let error = error.error.asTeamAccessDenied { + } else if error.error.asTeamAccessDenied != nil { return DBAUTHAccessError(teamAccessDenied: ()) } else if let error = error.error.asNoPermission { let noPermissionError: DBAUTHNoPermissionError = {