Commit 4118f41d authored by Jordan Petridis's avatar Jordan Petridis 🌱

Reduce extra allocations by using itertools::join instead of...

Reduce extra allocations by using itertools::join instead of std::iter::collect into std::iter::join.
parent 24b41fae
......@@ -189,6 +189,14 @@ dependencies = [
"either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itertools"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
......@@ -392,6 +400,7 @@ dependencies = [
"downcast-rs 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lalrpop 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lalrpop-util 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -507,6 +516,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd7d911c5dc610aabe37caae7d3b9d2cfe6d8f4c85ff4c062f3d6f490e75067"
"checksum gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "edc95561e538381576425264a4ddd08c65d5da218f10b2a47b4479dd147775da"
"checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc"
"checksum itertools 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "947aa0b9bb417792efa3936c5dada2d680b3bc27ea6a88ffa062f4c4d86ef8c5"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lalrpop 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ebe5a5c90d5edeecb7f62f6ebec0a3d0f6faf4759a052708348cda99fd311a0"
"checksum lalrpop-intern 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05410c1e4aff497bdea1ccb274ac35536fda0ee858600df36966502d4f7acbe3"
......
......@@ -12,6 +12,7 @@ downcast-rs = "^1.0.0"
regex = "^0.2.1"
lalrpop-util = "0.13.1"
cssparser = "^0.18.2"
itertools = "0.7.4"
[dependencies.cairo-sys-rs]
version = "0.4.0"
......
......@@ -4,6 +4,7 @@ extern crate cssparser;
extern crate glib;
extern crate glib_sys;
extern crate libc;
extern crate itertools;
#[macro_use]
extern crate downcast_rs;
......
use libc;
use glib::translate::*;
use itertools::Itertools;
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
......@@ -34,7 +35,6 @@ fn normalize_default(s: &str) -> String {
.collect::<String>()
// split at whitespace, also trims whitespace.
.split_whitespace()
.collect::<Vec<_>>()
.join(" ")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment