Swift cleanup: prefer case list over fallthrough in switch statements

Signed-off-by: Bryan Montz <bryanmontz@me.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Bryan Montz
2023-07-16 08:00:51 -05:00
committed by William Casarin
parent 0c627ae0a0
commit ecd8b64b8b
3 changed files with 4 additions and 11 deletions

View File

@@ -490,10 +490,7 @@ struct ContentView: View {
selected_timeline = .dms
damus_state.dms.set_active_dm(target.pubkey)
navigationCoordinator.push(route: Route.DMChat(dms: damus_state.dms.active_model))
case .like: fallthrough
case .zap: fallthrough
case .mention: fallthrough
case .repost:
case .like, .zap, .mention, .repost:
open_event(ev: target)
case .profile_zap:
// Handled separately above.

View File

@@ -165,9 +165,7 @@ class HomeModel {
}
switch kind {
case .chat: fallthrough
case .longform: fallthrough
case .text:
case .chat, .longform, .text:
handle_text_event(sub_id: sub_id, ev)
case .contacts:
handle_contact_event(sub_id: sub_id, relay_id: relay_id, ev: ev)
@@ -862,8 +860,7 @@ func guard_valid_event(events: EventCache, ev: NostrEvent, callback: @escaping (
case .ok:
callback()
case .bad_id: fallthrough
case .bad_sig:
case .bad_id, .bad_sig:
break
}
}

View File

@@ -182,8 +182,7 @@ func reacting_to_verb(group: EventGroupType) -> String {
return "reacted"
case .repost:
return "reposted"
case .zap: fallthrough
case .profile_zap:
case .zap, .profile_zap:
return "zapped"
}
}