summaryrefslogtreecommitdiffstats
path: root/libimagentrylink
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-09-06 10:56:23 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-09-06 15:30:26 +0200
commit40014051ec7a451412ab39790971dcab83bd88e5 (patch)
treef8df76af679c3c0e9fe20354c77fe4303da519b7 /libimagentrylink
parent584ac3d46ed184db2e8aab4e6e537629ffe3a271 (diff)
Bugfix: unique()ing the list of links
That should happen _after_ they are all in the same format. This commit introduces overhead, as we clone() each string here for comparison and that should clearly be fixed. Though the bug-fix is more important at this point.
Diffstat (limited to 'libimagentrylink')
-rw-r--r--libimagentrylink/src/internal.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/libimagentrylink/src/internal.rs b/libimagentrylink/src/internal.rs
index e6dddb6f..54d2b7de 100644
--- a/libimagentrylink/src/internal.rs
+++ b/libimagentrylink/src/internal.rs
@@ -100,8 +100,13 @@ impl InternalLinker for Entry {
fn links_into_values(links: Vec<StoreId>) -> Vec<Result<Value>> {
links
.into_iter()
- .unique()
.map(|s| s.without_base().to_str().map_err_into(LEK::InternalConversionError))
+ .unique_by(|entry| {
+ match entry {
+ &Ok(ref e) => Some(e.clone()),
+ &Err(_) => None,
+ }
+ })
.map(|elem| elem.map(Value::String))
.sorted_by(|a, b| {
match (a, b) {