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:
committed by
William Casarin
parent
0c627ae0a0
commit
ecd8b64b8b
@@ -490,10 +490,7 @@ struct ContentView: View {
|
|||||||
selected_timeline = .dms
|
selected_timeline = .dms
|
||||||
damus_state.dms.set_active_dm(target.pubkey)
|
damus_state.dms.set_active_dm(target.pubkey)
|
||||||
navigationCoordinator.push(route: Route.DMChat(dms: damus_state.dms.active_model))
|
navigationCoordinator.push(route: Route.DMChat(dms: damus_state.dms.active_model))
|
||||||
case .like: fallthrough
|
case .like, .zap, .mention, .repost:
|
||||||
case .zap: fallthrough
|
|
||||||
case .mention: fallthrough
|
|
||||||
case .repost:
|
|
||||||
open_event(ev: target)
|
open_event(ev: target)
|
||||||
case .profile_zap:
|
case .profile_zap:
|
||||||
// Handled separately above.
|
// Handled separately above.
|
||||||
|
|||||||
@@ -165,9 +165,7 @@ class HomeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch kind {
|
switch kind {
|
||||||
case .chat: fallthrough
|
case .chat, .longform, .text:
|
||||||
case .longform: fallthrough
|
|
||||||
case .text:
|
|
||||||
handle_text_event(sub_id: sub_id, ev)
|
handle_text_event(sub_id: sub_id, ev)
|
||||||
case .contacts:
|
case .contacts:
|
||||||
handle_contact_event(sub_id: sub_id, relay_id: relay_id, ev: ev)
|
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:
|
case .ok:
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
case .bad_id: fallthrough
|
case .bad_id, .bad_sig:
|
||||||
case .bad_sig:
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,8 +182,7 @@ func reacting_to_verb(group: EventGroupType) -> String {
|
|||||||
return "reacted"
|
return "reacted"
|
||||||
case .repost:
|
case .repost:
|
||||||
return "reposted"
|
return "reposted"
|
||||||
case .zap: fallthrough
|
case .zap, .profile_zap:
|
||||||
case .profile_zap:
|
|
||||||
return "zapped"
|
return "zapped"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user