From 5829d08bc036aade28896e1a6c84981534c8e05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Fri, 30 Nov 2018 14:32:29 +0100 Subject: [PATCH] chore: Avoid using the external library Itertools --- Cargo.toml | 1 - src/blob/ops.rs | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4e0799aab..81f33426c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ authors = ["Kerollmops "] bincode = "1.0" byteorder = "1.2" fnv = "1.0" -itertools = "0.7" lazy_static = "1.1" linked-hash-map = { version = "0.5", features = ["serde_impl"] } sdset = "0.3" diff --git a/src/blob/ops.rs b/src/blob/ops.rs index 0a9da3abf..faceab7cf 100644 --- a/src/blob/ops.rs +++ b/src/blob/ops.rs @@ -2,7 +2,6 @@ use std::error::Error; use fst::{IntoStreamer, Streamer}; use group_by::GroupBy; -use itertools::{Itertools, Either}; use sdset::duo::DifferenceByKey; use sdset::{Set, SetOperation}; @@ -47,7 +46,9 @@ impl OpBuilder { pub fn merge(self) -> Result> { let groups = GroupBy::new(&self.blobs, blob_same_sign); - let (positives, negatives): (Vec<_>, Vec<_>) = groups.partition_map(|blobs| { + let mut positives = Vec::new(); + let mut negatives = Vec::new(); + for blobs in groups { match blobs[0].sign() { Sign::Positive => { let mut op_builder = positive::OpBuilder::with_capacity(blobs.len()); @@ -65,7 +66,7 @@ impl OpBuilder { } let (map, doc_indexes) = builder.into_inner().unwrap(); let blob = PositiveBlob::from_bytes(map, doc_indexes).unwrap(); - Either::Left(blob) + positives.push(blob); }, Sign::Negative => { let mut op_builder = negative::OpBuilder::with_capacity(blobs.len()); @@ -73,10 +74,10 @@ impl OpBuilder { op_builder.push(unwrap_negative(blob)); } let blob = op_builder.union().into_negative_blob(); - Either::Right(blob) + negatives.push(blob); }, } - }); + } let mut zipped = positives.into_iter().zip(negatives); let mut buffer = Vec::new();