From 4d4b91117a02b55e913216459ae661d8dd166579 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 10 Dec 2020 19:29:11 +0100 Subject: Use itertools --- crates/project_model/Cargo.toml | 1 + crates/project_model/src/cargo_workspace.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'crates') 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" serde = { version = "1.0.106", features = ["derive"] } serde_json = "1.0.48" anyhow = "1.0.26" +itertools = "0.9.0" arena = { path = "../arena", version = "0.0.0" } cfg = { 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}; use arena::{Arena, Idx}; use base_db::Edition; use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; +use itertools::Itertools; use paths::{AbsPath, AbsPathBuf}; use rustc_hash::FxHashMap; @@ -407,9 +408,8 @@ fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, St env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string())); env.push(("CARGO_PKG_VERSION_PATCH".into(), package.version.patch.to_string())); - let pre = package.version.pre.iter().map(|id| id.to_string()).collect::>(); - let pre = pre.join("."); - env.push(("CARGO_PKG_VERSION_PRE".into(), pre)); + let pre = package.version.pre.iter().map(|id| id.to_string()).format("."); + env.push(("CARGO_PKG_VERSION_PRE".into(), pre.to_string())); let authors = package.authors.join(";"); env.push(("CARGO_PKG_AUTHORS".into(), authors)); -- cgit v1.2.3