From d06cff2a360839c67ce42a695f01bb933ba820c0 Mon Sep 17 00:00:00 2001 From: Eric Kuck Date: Wed, 12 Dec 2018 12:28:27 -0600 Subject: Tons more swiftlint warnings fixed. Still a few remaining. Signed-off-by: Eric Kuck --- WireGuard/Shared/Model/Endpoint.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'WireGuard/Shared/Model') diff --git a/WireGuard/Shared/Model/Endpoint.swift b/WireGuard/Shared/Model/Endpoint.swift index 38ffab9..bbf84d4 100644 --- a/WireGuard/Shared/Model/Endpoint.swift +++ b/WireGuard/Shared/Model/Endpoint.swift @@ -17,15 +17,15 @@ extension Endpoint { init?(from string: String) { // Separation of host and port is based on 'parse_endpoint' function in // https://git.zx2c4.com/WireGuard/tree/src/tools/config.c - guard (!string.isEmpty) else { return nil } + guard !string.isEmpty else { return nil } let startOfPort: String.Index let hostString: String - if (string.first! == "[") { + if string.first! == "[" { // Look for IPv6-style endpoint, like [::1]:80 let startOfHost = string.index(after: string.startIndex) guard let endOfHost = string.dropFirst().firstIndex(of: "]") else { return nil } let afterEndOfHost = string.index(after: endOfHost) - guard (string[afterEndOfHost] == ":") else { return nil } + guard string[afterEndOfHost] == ":" else { return nil } startOfPort = string.index(after: afterEndOfHost) hostString = String(string[startOfHost ..< endOfHost]) } else { @@ -38,12 +38,12 @@ extension Endpoint { let invalidCharacterIndex = hostString.unicodeScalars.firstIndex { char in return !CharacterSet.urlHostAllowed.contains(char) } - guard (invalidCharacterIndex == nil) else { return nil } + guard invalidCharacterIndex == nil else { return nil } host = NWEndpoint.Host(hostString) port = endpointPort } func stringRepresentation() -> String { - switch (host) { + switch host { case .name(let hostname, _): return "\(hostname):\(port)" case .ipv4(let address): @@ -78,7 +78,7 @@ extension Endpoint: Codable { extension Endpoint { func hasHostAsIPAddress() -> Bool { - switch (host) { + switch host { case .name: return false case .ipv4: @@ -89,7 +89,7 @@ extension Endpoint { } func hostname() -> String? { - switch (host) { + switch host { case .name(let hostname, _): return hostname case .ipv4: -- cgit v1.2.3-59-g8ed1b