diff --git a/Cargo.toml b/Cargo.toml index 3772917..5bb24fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,5 +27,4 @@ syn = { version = "1.0", features = ["full"] } proc-macro2 = { version = "1.0", features = ["span-locations"] } toml = "0.5" url = "2.0" -itertools = "0.9" -regex = "1.1" +regex = { version = "1.3", default-features = false, features = ["std", "unicode"] } diff --git a/src/helpers.rs b/src/helpers.rs index 991d8c0..48b7950 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -1,14 +1,35 @@ +use std::fmt::Display; use std::fs::File; use std::io::{self, Read}; use std::result; -use itertools::join; use semver_parser::range::{Op, VersionReq}; use semver_parser::version::Version; /// The common result type, our errors will be simple strings. pub type Result = result::Result; +fn join(iter: T, sep: &str) -> String +where + T: IntoIterator, + T::Item: Display, +{ + let mut buf = String::new(); + let mut iter = iter.into_iter(); + if let Some(item) = iter.next() { + let item = item.to_string(); + buf.push_str(&item); + } else { + return buf; + } + for item in iter { + buf.push_str(sep); + let item = item.to_string(); + buf.push_str(&item); + } + buf +} + /// Return all data from `path`. pub fn read_file(path: &str) -> io::Result { let mut file = File::open(path)?;