From 42faaf5a18a11fcecceb211c172322f537386f41 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Sat, 7 Sep 2019 10:16:10 +0200 Subject: [PATCH] fix: remove needless use of itertools * Remove needless use of `itertools` in `ethcore-light` * Replace `itertools::repeat::call` with `std::iter::repeat_with` --- Cargo.lock | 1 - ethcore/engines/authority-round/src/lib.rs | 4 ++-- ethcore/light/Cargo.toml | 1 - ethcore/light/src/client/header_chain.rs | 2 +- ethcore/light/src/lib.rs | 2 -- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63166c5c5d7..2c0cf489708 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1182,7 +1182,6 @@ dependencies = [ "fastmap 0.1.0", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "journaldb 0.2.0", "keccak-hash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.1.1", diff --git a/ethcore/engines/authority-round/src/lib.rs b/ethcore/engines/authority-round/src/lib.rs index 98aa8c22add..202b4dbc6c4 100644 --- a/ethcore/engines/authority-round/src/lib.rs +++ b/ethcore/engines/authority-round/src/lib.rs @@ -1506,7 +1506,7 @@ impl Engine for AuthorityRound { let mut hash = *chain_head.parent_hash(); - let mut ancestry = itertools::repeat_call(move || { + let mut ancestry = std::iter::repeat_with(move || { chain(hash).and_then(|header| { if header.number() == 0 { return None } hash = *header.parent_hash(); @@ -1548,7 +1548,7 @@ impl Engine for AuthorityRound { // to construct transition proof. author == ec_recover(sig) known // since the blocks are in the DB. let mut hash = chain_head.hash(); - let mut finality_proof: Vec<_> = itertools::repeat_call(move || { + let mut finality_proof: Vec<_> = std::iter::repeat_with(move || { chain(hash).and_then(|header| { hash = *header.parent_hash(); if header.number() == 0 { None } diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index 32e0c5e00d0..6309298d11f 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -34,7 +34,6 @@ rlp_derive = { path = "../../util/rlp-derive" } smallvec = "0.6" futures = "0.1" rand = "0.6" -itertools = "0.5" bincode = "1.1" serde = "1.0" serde_derive = "1.0" diff --git a/ethcore/light/src/client/header_chain.rs b/ethcore/light/src/client/header_chain.rs index 22b83c7325a..d473df97a4f 100644 --- a/ethcore/light/src/client/header_chain.rs +++ b/ethcore/light/src/client/header_chain.rs @@ -550,7 +550,7 @@ impl HeaderChain { let canon = &era_entry.candidates[0]; (canon.hash, canon.total_difficulty) }; - cht::compute_root(cht_num, ::itertools::repeat_call(iter)) + cht::compute_root(cht_num, std::iter::repeat_with(iter)) .expect("fails only when too few items; this is checked; qed") }; diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 61ce17e5632..0f748e920ed 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -67,11 +67,9 @@ extern crate ethereum_types; extern crate ethcore_miner as miner; extern crate hash_db; extern crate parity_util_mem; -extern crate parity_util_mem as mem; extern crate parity_util_mem as malloc_size_of; extern crate failsafe; extern crate futures; -extern crate itertools; extern crate keccak_hasher; extern crate machine; extern crate memory_db;