diff --git a/Cargo.toml b/Cargo.toml index 1858a60..00d989b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,7 @@ serde_json = "1" zstd = "0.11" run_script = "0.9" json5 = "0.4" +itertools = "0.10" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] instant = "0.1" diff --git a/src/unicode_helper.rs b/src/unicode_helper.rs index e5a2dea..8928f59 100644 --- a/src/unicode_helper.rs +++ b/src/unicode_helper.rs @@ -1,3 +1,5 @@ +use itertools::Itertools; + #[allow(dead_code)] pub fn to_unicode_hash(c: char) -> String { c.escape_unicode() @@ -15,16 +17,7 @@ pub fn to_chars_array(chars: Vec) -> String { &chars .iter() .map(|c| format!("'{}'", c.escape_unicode())) - .enumerate() - .map(|(i, x)| { - // Add comma and space if needed - match chars.len() > i + 1 { - true => x + ", ", - false => x, - } - }) - .collect::>() - .concat(), + .join(", "), "]", ] .concat()