diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-09-06 10:56:23 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-09-06 15:30:26 +0200 |
commit | 40014051ec7a451412ab39790971dcab83bd88e5 (patch) | |
tree | f8df76af679c3c0e9fe20354c77fe4303da519b7 /libimagentrylink | |
parent | 584ac3d46ed184db2e8aab4e6e537629ffe3a271 (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.rs | 7 |
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) { |