Use itertools

This commit is contained in:
Jonas Schievink 2020-12-10 19:29:11 +01:00
parent 41d73d1312
commit 4d4b91117a
3 changed files with 5 additions and 3 deletions

1
Cargo.lock generated
View file

@ -1229,6 +1229,7 @@ dependencies = [
"base_db",
"cargo_metadata",
"cfg",
"itertools",
"log",
"paths",
"proc_macro_api",

View file

@ -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" }

View file

@ -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::<Vec<_>>();
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));