change if-let with match for readability
@@ -60,8 +60,8 @@ impl<Env: Environment + 'static> UpdateWithCtx<Ctx<Env>> for MetaDetails {
}
Msg::Internal(AddonResponse(_, _)) => {
let metas_effects = addon_aggr_update(&mut self.metas, msg);
- let streams_effects = if let Some((_, Some(streams_resource_ref))) = &self.selected
- {
+ let streams_effects = match &self.selected {
+ Some((_, Some(streams_resource_ref))) => {
let streams_from_meta = self
.metas
.iter()
@@ -74,7 +74,8 @@ impl<Env: Environment + 'static> UpdateWithCtx<Ctx<Env>> for MetaDetails {
.videos
.iter()
.find(|video| {
- video.id == streams_resource_ref.id && !video.streams.is_empty()
+ video.id == streams_resource_ref.id
+ && !video.streams.is_empty()
})
.map_or(None, |video| Some((req, &video.streams)))
})
@@ -93,8 +94,8 @@ impl<Env: Environment + 'static> UpdateWithCtx<Ctx<Env>> for MetaDetails {
} else {
addon_aggr_update(&mut self.streams, msg)
}
- } else {
- Effects::none().unchanged()
+ }
+ _ => Effects::none().unchanged(),
};
metas_effects.join(streams_effects)
