fix: remove needless use of itertools (#11029)

* Remove needless use of `itertools` in `ethcore-light`
* Replace `itertools:🔁:call` with `std::iter::repeat_with`
This commit is contained in:
Niklas Adolfsson 2019-09-08 14:30:54 +02:00 committed by Andronik Ordian
parent 680807e601
commit a4969ca498
5 changed files with 3 additions and 7 deletions

1
Cargo.lock generated
View File

@ -1182,7 +1182,6 @@ dependencies = [
"fastmap 0.1.0", "fastmap 0.1.0",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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", "journaldb 0.2.0",
"keccak-hash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"keccak-hasher 0.1.1", "keccak-hasher 0.1.1",

View File

@ -1506,7 +1506,7 @@ impl Engine for AuthorityRound {
let mut hash = *chain_head.parent_hash(); 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| { chain(hash).and_then(|header| {
if header.number() == 0 { return None } if header.number() == 0 { return None }
hash = *header.parent_hash(); hash = *header.parent_hash();
@ -1548,7 +1548,7 @@ impl Engine for AuthorityRound {
// to construct transition proof. author == ec_recover(sig) known // to construct transition proof. author == ec_recover(sig) known
// since the blocks are in the DB. // since the blocks are in the DB.
let mut hash = chain_head.hash(); 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| { chain(hash).and_then(|header| {
hash = *header.parent_hash(); hash = *header.parent_hash();
if header.number() == 0 { None } if header.number() == 0 { None }

View File

@ -34,7 +34,6 @@ rlp_derive = { path = "../../util/rlp-derive" }
smallvec = "0.6" smallvec = "0.6"
futures = "0.1" futures = "0.1"
rand = "0.6" rand = "0.6"
itertools = "0.5"
bincode = "1.1" bincode = "1.1"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"

View File

@ -550,7 +550,7 @@ impl HeaderChain {
let canon = &era_entry.candidates[0]; let canon = &era_entry.candidates[0];
(canon.hash, canon.total_difficulty) (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") .expect("fails only when too few items; this is checked; qed")
}; };

View File

@ -67,11 +67,9 @@ extern crate ethereum_types;
extern crate ethcore_miner as miner; extern crate ethcore_miner as miner;
extern crate hash_db; extern crate hash_db;
extern crate parity_util_mem; extern crate parity_util_mem;
extern crate parity_util_mem as mem;
extern crate parity_util_mem as malloc_size_of; extern crate parity_util_mem as malloc_size_of;
extern crate failsafe; extern crate failsafe;
extern crate futures; extern crate futures;
extern crate itertools;
extern crate keccak_hasher; extern crate keccak_hasher;
extern crate machine; extern crate machine;
extern crate memory_db; extern crate memory_db;