Drop return in single line functions

This commit is contained in:
Davide De Rosa 2022-07-16 15:06:35 +02:00
parent 8d5f147194
commit 48d8173871
7 changed files with 27 additions and 31 deletions

View File

@ -28,15 +28,15 @@ import PassepartoutLibrary
extension ProviderMetadata: Identifiable, Comparable, Hashable {
public var id: String {
return name
name
}
public static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.name == rhs.name
lhs.name == rhs.name
}
public static func <(lhs: Self, rhs: Self) -> Bool {
return lhs.fullName.lowercased() < rhs.fullName.lowercased()
lhs.fullName.lowercased() < rhs.fullName.lowercased()
}
public func hash(into hasher: inout Hasher) {
@ -46,27 +46,27 @@ extension ProviderMetadata: Identifiable, Comparable, Hashable {
extension ProviderCategory: Comparable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.name.lowercased() == rhs.name.lowercased()
lhs.name.lowercased() == rhs.name.lowercased()
}
public static func <(lhs: Self, rhs: Self) -> Bool {
return lhs.name.lowercased() < rhs.name.lowercased()
lhs.name.lowercased() < rhs.name.lowercased()
}
}
extension ProviderLocation: Comparable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.countryCode == rhs.countryCode
lhs.countryCode == rhs.countryCode
}
public static func <(lhs: Self, rhs: Self) -> Bool {
return lhs.localizedCountry < rhs.localizedCountry
lhs.localizedCountry < rhs.localizedCountry
}
}
extension ProviderServer: Comparable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.id == rhs.id
lhs.id == rhs.id
}
// "Default" comes first
@ -86,11 +86,11 @@ extension ProviderServer: Comparable {
extension ProviderServer.Preset: Comparable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.name == rhs.name
lhs.name == rhs.name
}
public static func <(lhs: Self, rhs: Self) -> Bool {
return lhs.name < rhs.name
lhs.name < rhs.name
}
}

View File

@ -28,13 +28,13 @@ import TunnelKitOpenVPN
extension OpenVPN.Cipher {
var localizedDescription: String {
return description
description
}
}
extension OpenVPN.Digest {
var localizedDescription: String {
return description
description
}
}

View File

@ -27,10 +27,6 @@ import Foundation
import PassepartoutLibrary
extension ProviderManager {
// func localizedLocation(forProfile profile: Profile) -> String? {
// return profile.providerServer(self)?.localizedDescription
// }
func localizedPreset(forProfile profile: Profile) -> String? {
guard let server = profile.providerServer(self) else {
return nil
@ -65,13 +61,13 @@ extension ProviderMetadata {
extension ProviderLocation {
var localizedCountry: String {
return countryCode.localizedAsCountryCode
countryCode.localizedAsCountryCode
}
}
extension ProviderServer {
var localizedCountry: String {
return countryCode.localizedAsCountryCode
countryCode.localizedAsCountryCode
}
var localizedDescription: String {
@ -83,16 +79,16 @@ extension ProviderServer {
}
var localizedDetails: String {
return details ?? ""
details ?? ""
}
var localizedDetailsWithDefault: String {
return details ?? "\(L10n.Global.Strings.default) [\(apiId)]"
details ?? "\(L10n.Global.Strings.default) [\(apiId)]"
}
}
extension ProviderServer.Preset {
var localizedDescription: String {
return name
name
}
}

View File

@ -86,7 +86,7 @@ extension Optional where Wrapped == IPv4Settings {
}
var localizedDefaultGateway: String {
return self?.defaultGateway ?? L10n.Global.Strings.none
self?.defaultGateway ?? L10n.Global.Strings.none
}
}
@ -100,19 +100,19 @@ extension Optional where Wrapped == IPv6Settings {
}
var localizedDefaultGateway: String {
return self?.defaultGateway ?? L10n.Global.Strings.none
self?.defaultGateway ?? L10n.Global.Strings.none
}
}
extension IPv4Settings.Route {
var localizedDescription: String {
return "\(destination)/\(mask) -> \(gateway)"
"\(destination)/\(mask) -> \(gateway)"
}
}
extension IPv6Settings.Route {
var localizedDescription: String {
return "\(destination)/\(prefixLength) -> \(gateway)"
"\(destination)/\(prefixLength) -> \(gateway)"
}
}
@ -180,7 +180,7 @@ extension Error {
}
private func neErrorDescription(_ error: NEVPNError) -> String? {
return error.localizedDescription.capitalized
error.localizedDescription.capitalized
}
}

View File

@ -31,19 +31,19 @@ import CryptoKit
extension ProviderCategory: Identifiable {
public var id: String {
return "\(providerMetadata.name):\(name)"
"\(providerMetadata.name):\(name)"
}
}
extension ProviderLocation: Identifiable {
public var id: String {
return "\(providerMetadata.name):\(categoryName):\(countryCode)"
"\(providerMetadata.name):\(categoryName):\(countryCode)"
}
}
extension ProviderServer {
public var locationId: String {
return "\(providerMetadata.name):\(categoryName):\(countryCode)"
"\(providerMetadata.name):\(categoryName):\(countryCode)"
}
}

View File

@ -28,6 +28,6 @@ import PassepartoutCore
extension ProviderServer {
public var logDescription: String {
return "{'\(categoryName)', \(countryCode), '\(apiId)', \(id)}"
"{'\(categoryName)', \(countryCode), '\(apiId)', \(id)}"
}
}

View File

@ -28,7 +28,7 @@ import PassepartoutCore
extension ProviderName {
public func requiresCredentials(forProtocol vpnProtocol: VPNProtocolType) -> Bool {
return vpnProtocol == .openVPN
vpnProtocol == .openVPN
}
public var credentialsPurpose: CredentialsPurpose {