diff --git a/.swiftlint.yml b/.swiftlint.yml index 6ac8ebf..3274812 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -163,7 +163,7 @@ whitelist_rules: - syntactic_sugar - todo - toggle_bool -# - trailing_closure + - trailing_closure # - trailing_comma - trailing_newline - trailing_semicolon diff --git a/passExtension/Crypto/GopenPGPInterface.swift b/passExtension/Crypto/GopenPGPInterface.swift index 118a5d2..1916bb4 100644 --- a/passExtension/Crypto/GopenPGPInterface.swift +++ b/passExtension/Crypto/GopenPGPInterface.swift @@ -63,11 +63,11 @@ struct GopenPGPInterface: PGPInterface { } func containsPublicKey(with keyID: String) -> Bool { - publicKeys.keys.contains(where: { key in key.hasSuffix(keyID.lowercased()) }) + publicKeys.keys.contains { key in key.hasSuffix(keyID.lowercased()) } } func containsPrivateKey(with keyID: String) -> Bool { - privateKeys.keys.contains(where: { key in key.hasSuffix(keyID.lowercased()) }) + privateKeys.keys.contains { key in key.hasSuffix(keyID.lowercased()) } } func decrypt(encryptedData: Data, keyID: String, passphrase: String) throws -> Data? { diff --git a/passKit/Helpers/AppError.swift b/passKit/Helpers/AppError.swift index e2ca7b7..9958a62 100644 --- a/passKit/Helpers/AppError.swift +++ b/passKit/Helpers/AppError.swift @@ -30,7 +30,7 @@ public enum AppError: Error, Equatable { extension AppError: LocalizedError { public var errorDescription: String? { - let localizationKey = "\(String(describing: self).prefix(while: { $0 != "(" }))Error." + let localizationKey = "\(String(describing: self).prefix { $0 != "(" })Error." switch self { case let .RepositoryRemoteBranchNotFound(name), let .RepositoryBranchNotFound(name), let .ReadingFile(name): return localizationKey.localize(name) diff --git a/passKit/Models/Password.swift b/passKit/Models/Password.swift index aa306f3..0cffe10 100644 --- a/passKit/Models/Password.swift +++ b/passKit/Models/Password.swift @@ -130,7 +130,7 @@ public class Password { private func getAdditionValue(withKey key: String, caseSensitive: Bool = false) -> String? { let toLowercase = { (string: String) -> String in caseSensitive ? string : string.lowercased() } - return additions.first(where: { toLowercase($0.title) == toLowercase(key) })?.content + return additions.first { toLowercase($0.title) == toLowercase(key) }?.content } /// Set the OTP token if we are able to construct a valid one. diff --git a/passKitTests/Passwords/PasswordGeneratorTest.swift b/passKitTests/Passwords/PasswordGeneratorTest.swift index 05e66e4..8b4f68e 100644 --- a/passKitTests/Passwords/PasswordGeneratorTest.swift +++ b/passKitTests/Passwords/PasswordGeneratorTest.swift @@ -70,7 +70,7 @@ class PasswordGeneratorTest: XCTestCase { PasswordGenerator(flavor: .xkcd, length: 8, useSpecialSymbols: false), PasswordGenerator(flavor: .xkcd, length: 1, useSpecialSymbols: false), ].forEach { generator in - XCTAssertEqual(generator.generate().split(whereSeparator: { "0123456789".contains($0) }).count, generator.limitedLength) + XCTAssertEqual(generator.generate().split { "0123456789".contains($0) }.count, generator.limitedLength) } }