global: fix remaining swiftlint violations

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-12-09 14:35:21 +01:00
parent d875266db5
commit d4fd17cd8f
4 changed files with 5 additions and 4 deletions

View File

@ -7,6 +7,7 @@ disabled_rules:
- type_body_length
- function_body_length
- nesting
- inclusive_language
opt_in_rules:
- empty_count
- empty_string

View File

@ -266,7 +266,7 @@ extension TunnelEditTableViewController {
guard let self = self else { return }
let isAllowedIPsChanged = self.tunnelViewModel.updateDNSServersInAllowedIPsIfRequired(oldDNSServers: oldValue, newDNSServers: newValue)
if isAllowedIPsChanged {
let section = self.sections.firstIndex { if case .peer(_) = $0 { return true } else { return false } }
let section = self.sections.firstIndex { if case .peer = $0 { return true } else { return false } }
if let section = section, let row = self.peerFields.firstIndex(of: .allowedIPs) {
self.tableView.reloadRows(at: [IndexPath(row: row, section: section)], with: .none)
}

View File

@ -246,7 +246,7 @@ class TunnelDetailTableViewController: NSViewController {
var modifiedRowIndices = IndexSet()
for (index, field) in fields.enumerated() {
guard let change = changes[field] else { continue }
if case .modified(_) = change {
if case .modified = change {
let row = modelRowsInSection[0 ..< index].filter { $0.isVisible }.count
modifiedRowIndices.insert(rowOffset + row)
}

View File

@ -31,7 +31,7 @@ class PacketTunnelSettingsGenerator {
switch result {
case .success(.some(let endpoint)):
if case .name(_, _) = endpoint.host { assert(false, "Endpoint is not resolved") }
if case .name = endpoint.host { assert(false, "Endpoint is not resolved") }
wgSettings.append("endpoint=\(endpoint.stringRepresentation)\n")
case .success(.none):
break
@ -58,7 +58,7 @@ class PacketTunnelSettingsGenerator {
wgSettings.append("preshared_key=\(preSharedKey)\n")
}
if let endpoint = try? resolvedEndpoints[index]?.withReresolvedIP() {
if case .name(_, _) = endpoint.host { assert(false, "Endpoint is not resolved") }
if case .name = endpoint.host { assert(false, "Endpoint is not resolved") }
wgSettings.append("endpoint=\(endpoint.stringRepresentation)\n")
}
let persistentKeepAlive = peer.persistentKeepAlive ?? 0