commit 6bf52937014b238d17369bee2bc40ea1933c6d82
parent 3d6909bf62408d2bc2d39d6c6e3cb021e5f02533
Author: Bryan Montz <bryanmontz@me.com>
Date: Sun, 16 Jul 2023 08:00:53 -0500
Swift cleanup: don't capture case values only to ignore them in switch statements
Signed-off-by: Bryan Montz <bryanmontz@me.com>
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
7 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/damus/ContentView.swift b/damus/ContentView.swift
@@ -856,7 +856,7 @@ func find_event(state: DamusState, query query_: FindEvent, callback: @escaping
}
state.pool.unsubscribe(sub_id: subid, to: [relay_id])
}
- case .notice(_):
+ case .notice:
break
}
diff --git a/damus/Models/EventsModel.swift b/damus/Models/EventsModel.swift
@@ -62,11 +62,11 @@ class EventsModel: ObservableObject {
switch nev {
case .event(_, let ev):
handle_event(relay_id: relay_id, ev: ev)
- case .notice(_):
+ case .notice:
break
case .ok:
break
- case .eose(_):
+ case .eose:
load_profiles(profiles_subid: profiles_id, relay_id: relay_id, load: .from_events(events), damus_state: state)
}
}
diff --git a/damus/Nostr/NostrResponse.swift b/damus/Nostr/NostrResponse.swift
@@ -21,7 +21,7 @@ enum NostrResponse: Decodable {
var subid: String? {
switch self {
- case .ok(_):
+ case .ok:
return nil
case .event(let sub_id, _):
return sub_id
diff --git a/damus/Nostr/WebSocket.swift b/damus/Nostr/WebSocket.swift
@@ -18,7 +18,7 @@ enum WebSocketEvent {
switch self {
case .connected:
return "Connected"
- case .message(_):
+ case .message:
return nil // adding this to the RelayLog was too noisy
case .disconnected(let close_code, let reason):
return "Disconnected: Close code: \(close_code), reason: \(reason ?? "unknown")"
diff --git a/damus/Util/Extensions/KFOptionSetter+.swift b/damus/Util/Extensions/KFOptionSetter+.swift
@@ -86,7 +86,7 @@ struct CustomImageProcessor: ImageProcessor {
func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {
switch item {
- case .image(_):
+ case .image:
// This case will never run
return DefaultImageProcessor.default.process(item: item, options: options)
case .data(let data):
diff --git a/damus/Util/Router.swift b/damus/Util/Router.swift
@@ -120,13 +120,13 @@ enum Route: Hashable {
return lhs_pubkey == rhs_pubkey
case (.Profile (let lhs_profile, _), .Profile(let rhs_profile, _)):
return lhs_profile == rhs_profile
- case (.Followers (_), .Followers (_)):
+ case (.Followers, .Followers):
return true
case (.Relay (let lhs_relay, _), .Relay (let rhs_relay, _)):
return lhs_relay == rhs_relay
case (.RelayDetail(let lhs_relay, _), .RelayDetail(let rhs_relay, _)):
return lhs_relay == rhs_relay
- case (.Following(_), .Following(_)):
+ case (.Following, .Following):
return true
case (.MuteList(let lhs_users), .MuteList(let rhs_users)):
return lhs_users == rhs_users
@@ -144,17 +144,17 @@ enum Route: Hashable {
return lhs_relays == rhs_relays
case (.KeySettings(let lhs_keypair), .KeySettings(let rhs_keypair)):
return lhs_keypair.pubkey == rhs_keypair.pubkey
- case (.AppearanceSettings(_), .AppearanceSettings(_)):
+ case (.AppearanceSettings, .AppearanceSettings):
return true
- case (.NotificationSettings(_), .NotificationSettings(_)):
+ case (.NotificationSettings, .NotificationSettings):
return true
- case (.ZapSettings(_), .ZapSettings(_)):
+ case (.ZapSettings, .ZapSettings):
return true
- case (.TranslationSettings(_), .TranslationSettings(_)):
+ case (.TranslationSettings, .TranslationSettings):
return true
- case (.SearchSettings(_), .SearchSettings(_)):
+ case (.SearchSettings, .SearchSettings):
return true
- case (.DeveloperSettings(_), .DeveloperSettings(_)):
+ case (.DeveloperSettings, .DeveloperSettings):
return true
case (.Thread(let lhs_threadModel), .Thread(thread: let rhs_threadModel)):
return lhs_threadModel.event.id == rhs_threadModel.event.id
@@ -174,13 +174,13 @@ enum Route: Hashable {
return true
case (.SaveKeys(let lhs_account), .SaveKeys(let rhs_account)):
return lhs_account.pubkey == rhs_account.pubkey
- case (.Wallet(_), .Wallet(_)):
+ case (.Wallet, .Wallet):
return true
- case (.WalletScanner(_), .WalletScanner(_)):
+ case (.WalletScanner, .WalletScanner):
return true
- case (.FollowersYouKnow(_, _), .FollowersYouKnow(_, _)):
+ case (.FollowersYouKnow, .FollowersYouKnow):
return true
- case (.Script(_), .Script(_)):
+ case (.Script, .Script):
return true
default:
return false
@@ -195,7 +195,7 @@ enum Route: Hashable {
case .Profile(let profile, _):
hasher.combine("profile")
hasher.combine(profile.pubkey)
- case .Followers(_):
+ case .Followers:
hasher.combine("followers")
case .Relay(let relay, _):
hasher.combine("relay")
@@ -203,7 +203,7 @@ enum Route: Hashable {
case .RelayDetail(let relay, _):
hasher.combine("relayDetail")
hasher.combine(relay)
- case .Following(_):
+ case .Following:
hasher.combine("following")
case .MuteList(let users):
hasher.combine("muteList")
@@ -225,15 +225,15 @@ enum Route: Hashable {
case .KeySettings(let keypair):
hasher.combine("keySettings")
hasher.combine(keypair.pubkey)
- case .AppearanceSettings(_):
+ case .AppearanceSettings:
hasher.combine("appearanceSettings")
- case .NotificationSettings(_):
+ case .NotificationSettings:
hasher.combine("notificationSettings")
- case .ZapSettings(_):
+ case .ZapSettings:
hasher.combine("zapSettings")
- case .TranslationSettings(_):
+ case .TranslationSettings:
hasher.combine("translationSettings")
- case .SearchSettings(_):
+ case .SearchSettings:
hasher.combine("searchSettings")
case .DeveloperSettings:
hasher.combine("developerSettings")
@@ -263,9 +263,9 @@ enum Route: Hashable {
case .SaveKeys(let account):
hasher.combine("saveKeys")
hasher.combine(account.pubkey)
- case .Wallet(_):
+ case .Wallet:
hasher.combine("wallet")
- case .WalletScanner(_):
+ case .WalletScanner:
hasher.combine("walletScanner")
case .FollowersYouKnow(let friendedFollowers, let followers):
hasher.combine("followersYouKnow")
diff --git a/damus/Util/Zaps.swift b/damus/Util/Zaps.swift
@@ -68,7 +68,7 @@ class Zaps {
} else {
insert_uniq_sorted_zap_by_amount(zaps: &(our_zaps[note_target.note_id]!), new_zap: zap)
}
- case .profile(_):
+ case .profile:
break
}
}