summaryrefslogtreecommitdiffstats
path: root/src/package
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-08 14:56:56 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-08 14:56:58 +0100
commit3d08927a721854f52a2aa2743c645c8aecf5a32e (patch)
treee249c0b8db31a3f104f8ec86bcaf5924bc0ed09f /src/package
parent24fff4c70f07fd51dee40aea52f136bc69f75d65 (diff)
Fix: build and runtime deps should be unique
Before this patch, if a package had the following dependencies: build = ["other =1"] runtime = ["other =1"] the package "other" in version "1" was built twice. This is not necessary, we only need to build "other" once. This patch fixes this bug. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/package')
-rw-r--r--src/package/package.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/package/package.rs b/src/package/package.rs
index 4be822f..998816d 100644
--- a/src/package/package.rs
+++ b/src/package/package.rs
@@ -3,6 +3,7 @@ use std::path::PathBuf;
use anyhow::Result;
use getset::Getters;
+use itertools::Itertools;
use serde::Deserialize;
use serde::Serialize;
@@ -86,7 +87,9 @@ impl Package {
.cloned()
.map(|d| d.parse_as_name_and_version());
- build_iter.chain(runtime_iter)
+ build_iter
+ .chain(runtime_iter)
+ .unique_by(|res| res.as_ref().ok().map(|tpl| tpl.clone()))
}
}