aboutsummaryrefslogtreecommitdiff
path: root/import/src
diff options
context:
space:
mode:
Diffstat (limited to 'import/src')
-rw-r--r--import/src/lib.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs
index 3b74029..4776bd2 100644
--- a/import/src/lib.rs
+++ b/import/src/lib.rs
@@ -28,8 +28,10 @@ use log::{debug, info, warn};
use regex::Regex;
use std::{
cmp::Ordering,
+ collections::HashSet,
ffi::OsStr,
fs::File,
+ hash::RandomState,
io::BufReader,
ops::Deref,
path::{Path, PathBuf},
@@ -456,12 +458,7 @@ fn merge_node(x: Node, y: Node) -> Node {
title: x.public.title.or(y.public.title),
id: x.public.id.or(y.public.id),
path: vec![],
- children: x
- .public
- .children
- .into_iter()
- .chain(y.public.children)
- .collect(),
+ children: merge_children(x.public.children, y.public.children),
tagline: x.public.tagline.or(y.public.tagline),
description: x.public.description.or(y.public.description),
release_date: x.public.release_date.or(y.public.release_date),
@@ -484,6 +481,16 @@ fn merge_node(x: Node, y: Node) -> Node {
}
}
+fn merge_children(mut a: Vec<String>, b: Vec<String>) -> Vec<String> {
+ let acont = HashSet::<_, RandomState>::from_iter(a.clone());
+ for el in b {
+ if !acont.contains(&el) {
+ a.push(el)
+ }
+ }
+ a
+}
+
static SEM_REMOTE_IMPORT: Semaphore = Semaphore::const_new(16);
#[async_recursion]