Switching to iterator.

This commit is contained in:
Dessalines 2020-09-23 13:52:59 -05:00
parent 63cf0a8eb6
commit 4f6a53b7cf

View file

@ -107,11 +107,12 @@ pub(in crate::api) async fn linked_instances(pool: &DbPool) -> Result<Vec<String
}) })
.await??; .await??;
for actor_id in &distinct_communities { instances = distinct_communities
instances.push(Url::parse(actor_id)?.host_str().unwrap_or("").to_string()); .iter()
} .map(|actor_id| Ok(Url::parse(actor_id)?.host_str().unwrap_or("").to_string()))
.collect::<Result<Vec<String>, LemmyError>>()?;
instances.extend(Settings::get().get_allowed_instances().into_iter()); instances.append(&mut Settings::get().get_allowed_instances());
instances.retain(|a| { instances.retain(|a| {
!Settings::get().get_blocked_instances().contains(a) !Settings::get().get_blocked_instances().contains(a)
&& !a.eq("") && !a.eq("")