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 - type_body_length
- function_body_length - function_body_length
- nesting - nesting
- inclusive_language
opt_in_rules: opt_in_rules:
- empty_count - empty_count
- empty_string - empty_string

View File

@ -266,7 +266,7 @@ extension TunnelEditTableViewController {
guard let self = self else { return } guard let self = self else { return }
let isAllowedIPsChanged = self.tunnelViewModel.updateDNSServersInAllowedIPsIfRequired(oldDNSServers: oldValue, newDNSServers: newValue) let isAllowedIPsChanged = self.tunnelViewModel.updateDNSServersInAllowedIPsIfRequired(oldDNSServers: oldValue, newDNSServers: newValue)
if isAllowedIPsChanged { 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) { if let section = section, let row = self.peerFields.firstIndex(of: .allowedIPs) {
self.tableView.reloadRows(at: [IndexPath(row: row, section: section)], with: .none) self.tableView.reloadRows(at: [IndexPath(row: row, section: section)], with: .none)
} }

View File

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

View File

@ -31,7 +31,7 @@ class PacketTunnelSettingsGenerator {
switch result { switch result {
case .success(.some(let endpoint)): 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") wgSettings.append("endpoint=\(endpoint.stringRepresentation)\n")
case .success(.none): case .success(.none):
break break
@ -58,7 +58,7 @@ class PacketTunnelSettingsGenerator {
wgSettings.append("preshared_key=\(preSharedKey)\n") wgSettings.append("preshared_key=\(preSharedKey)\n")
} }
if let endpoint = try? resolvedEndpoints[index]?.withReresolvedIP() { 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") wgSettings.append("endpoint=\(endpoint.stringRepresentation)\n")
} }
let persistentKeepAlive = peer.persistentKeepAlive ?? 0 let persistentKeepAlive = peer.persistentKeepAlive ?? 0