Fix: Make sure links are sorted and deduplicated
This commit is contained in:
parent
d89a700fd1
commit
59ddb70345
1 changed files with 12 additions and 0 deletions
|
@ -98,9 +98,15 @@ impl Linkable for Entry {
|
||||||
let mut left_internal = left.internal.unwrap_or_else(|| vec![]);
|
let mut left_internal = left.internal.unwrap_or_else(|| vec![]);
|
||||||
left_internal.push(right_location);
|
left_internal.push(right_location);
|
||||||
|
|
||||||
|
left_internal.sort_unstable();
|
||||||
|
left_internal.dedup();
|
||||||
|
|
||||||
let mut right_internal = right.internal.unwrap_or_else(|| vec![]);
|
let mut right_internal = right.internal.unwrap_or_else(|| vec![]);
|
||||||
right_internal.push(left_location);
|
right_internal.push(left_location);
|
||||||
|
|
||||||
|
right_internal.sort_unstable();
|
||||||
|
right_internal.dedup();
|
||||||
|
|
||||||
left.internal = Some(left_internal);
|
left.internal = Some(left_internal);
|
||||||
right.internal = Some(right_internal);
|
right.internal = Some(right_internal);
|
||||||
|
|
||||||
|
@ -117,9 +123,15 @@ impl Linkable for Entry {
|
||||||
let mut left_internal = left.internal.unwrap_or_else(|| vec![]);
|
let mut left_internal = left.internal.unwrap_or_else(|| vec![]);
|
||||||
left_internal.retain(|l| *l != right_location);
|
left_internal.retain(|l| *l != right_location);
|
||||||
|
|
||||||
|
left_internal.sort_unstable();
|
||||||
|
left_internal.dedup();
|
||||||
|
|
||||||
let mut right_internal = right.internal.unwrap_or_else(|| vec![]);
|
let mut right_internal = right.internal.unwrap_or_else(|| vec![]);
|
||||||
right_internal.retain(|l| *l != left_location);
|
right_internal.retain(|l| *l != left_location);
|
||||||
|
|
||||||
|
right_internal.sort_unstable();
|
||||||
|
right_internal.dedup();
|
||||||
|
|
||||||
left.internal = Some(left_internal);
|
left.internal = Some(left_internal);
|
||||||
right.internal = Some(right_internal);
|
right.internal = Some(right_internal);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue