From 89d8abefe7742e6dfcc73c29b5a453cf84374a8e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 3 May 2017 21:40:05 +0200 Subject: [PATCH] Ignore duplicated keys --- libimagstore/Cargo.toml | 1 + libimagstore/src/configuration.rs | 4 +++- libimagstore/src/lib.rs | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libimagstore/Cargo.toml b/libimagstore/Cargo.toml index f2e12cc0..99ee6c1a 100644 --- a/libimagstore/Cargo.toml +++ b/libimagstore/Cargo.toml @@ -24,6 +24,7 @@ toml = "^0.4" version = "2.0.1" crossbeam = "0.2.*" walkdir = "1.0.*" +itertools = "0.6.*" [dependencies.libimagerror] path = "../libimagerror" diff --git a/libimagstore/src/configuration.rs b/libimagstore/src/configuration.rs index 2b475c95..06e0d3c3 100644 --- a/libimagstore/src/configuration.rs +++ b/libimagstore/src/configuration.rs @@ -329,6 +329,7 @@ impl AspectConfig { } fn get_aspect_names_for_aspect_position(config_name: &'static str, value: &Option) -> Vec { + use itertools::Itertools; let mut v = vec![]; match *value { @@ -348,7 +349,8 @@ fn get_aspect_names_for_aspect_position(config_name: &'static str, value: &Optio None => warn!("No store configuration, cannot get '{}'", config_name), _ => warn!("Configuration is not a table"), } - v + + v.into_iter().unique().collect() } #[cfg(test)] diff --git a/libimagstore/src/lib.rs b/libimagstore/src/lib.rs index 56c3a742..835704a3 100644 --- a/libimagstore/src/lib.rs +++ b/libimagstore/src/lib.rs @@ -42,6 +42,7 @@ extern crate toml; extern crate semver; extern crate crossbeam; extern crate walkdir; +extern crate itertools; #[macro_use] extern crate libimagerror; #[macro_use] extern crate libimagutil;