aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-12-10 18:29:11 +0000
committerJonas Schievink <[email protected]>2020-12-10 18:29:11 +0000
commit4d4b91117a02b55e913216459ae661d8dd166579 (patch)
tree30e840e17725f3cb6f2d5c223ba6b05acffabbf4
parent41d73d131266c864495ce592749b74f580b17b23 (diff)
Use itertools
-rw-r--r--Cargo.lock1
-rw-r--r--crates/project_model/Cargo.toml1
-rw-r--r--crates/project_model/src/cargo_workspace.rs6
3 files changed, 5 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c6994127b..d3aec4c99 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1229,6 +1229,7 @@ dependencies = [
1229 "base_db", 1229 "base_db",
1230 "cargo_metadata", 1230 "cargo_metadata",
1231 "cfg", 1231 "cfg",
1232 "itertools",
1232 "log", 1233 "log",
1233 "paths", 1234 "paths",
1234 "proc_macro_api", 1235 "proc_macro_api",
diff --git a/crates/project_model/Cargo.toml b/crates/project_model/Cargo.toml
index e0c591603..c55e85709 100644
--- a/crates/project_model/Cargo.toml
+++ b/crates/project_model/Cargo.toml
@@ -16,6 +16,7 @@ cargo_metadata = "=0.12.0"
16serde = { version = "1.0.106", features = ["derive"] } 16serde = { version = "1.0.106", features = ["derive"] }
17serde_json = "1.0.48" 17serde_json = "1.0.48"
18anyhow = "1.0.26" 18anyhow = "1.0.26"
19itertools = "0.9.0"
19 20
20arena = { path = "../arena", version = "0.0.0" } 21arena = { path = "../arena", version = "0.0.0" }
21cfg = { path = "../cfg", version = "0.0.0" } 22cfg = { path = "../cfg", version = "0.0.0" }
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs
index 4c1ba5e75..894c5c952 100644
--- a/crates/project_model/src/cargo_workspace.rs
+++ b/crates/project_model/src/cargo_workspace.rs
@@ -11,6 +11,7 @@ use anyhow::{Context, Result};
11use arena::{Arena, Idx}; 11use arena::{Arena, Idx};
12use base_db::Edition; 12use base_db::Edition;
13use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; 13use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId};
14use itertools::Itertools;
14use paths::{AbsPath, AbsPathBuf}; 15use paths::{AbsPath, AbsPathBuf};
15use rustc_hash::FxHashMap; 16use rustc_hash::FxHashMap;
16 17
@@ -407,9 +408,8 @@ fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, St
407 env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string())); 408 env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string()));
408 env.push(("CARGO_PKG_VERSION_PATCH".into(), package.version.patch.to_string())); 409 env.push(("CARGO_PKG_VERSION_PATCH".into(), package.version.patch.to_string()));
409 410
410 let pre = package.version.pre.iter().map(|id| id.to_string()).collect::<Vec<_>>(); 411 let pre = package.version.pre.iter().map(|id| id.to_string()).format(".");
411 let pre = pre.join("."); 412 env.push(("CARGO_PKG_VERSION_PRE".into(), pre.to_string()));
412 env.push(("CARGO_PKG_VERSION_PRE".into(), pre));
413 413
414 let authors = package.authors.join(";"); 414 let authors = package.authors.join(";");
415 env.push(("CARGO_PKG_AUTHORS".into(), authors)); 415 env.push(("CARGO_PKG_AUTHORS".into(), authors));