Switching to iterator.
This commit is contained in:
parent
63cf0a8eb6
commit
4f6a53b7cf
1 changed files with 5 additions and 4 deletions
|
@ -107,11 +107,12 @@ pub(in crate::api) async fn linked_instances(pool: &DbPool) -> Result<Vec<String
|
|||
})
|
||||
.await??;
|
||||
|
||||
for actor_id in &distinct_communities {
|
||||
instances.push(Url::parse(actor_id)?.host_str().unwrap_or("").to_string());
|
||||
}
|
||||
instances = distinct_communities
|
||||
.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| {
|
||||
!Settings::get().get_blocked_instances().contains(a)
|
||||
&& !a.eq("")
|
||||
|
|
Loading…
Reference in a new issue