Abuse a closure instead of abusing options/iterators quite so much

This commit is contained in:
Julia 2023-02-04 01:30:24 -05:00
parent 58c41778e7
commit 33c265d3cf
2 changed files with 17 additions and 32 deletions

View file

@ -459,10 +459,10 @@ impl Room {
self.participant_user_ids.contains(&user_id)
}
pub fn follows(&self, leader_id: PeerId) -> &[PeerId] {
pub fn follows(&self, leader_id: PeerId) -> Option<&[PeerId]> {
self.follows_by_leader_id
.get(&leader_id)
.map_or(&[], |v| v.as_slice())
.map(|v| v.as_slice())
}
async fn handle_room_updated(