From 11dcb009e5159b6465edb69b85f85cfb74b06357 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Thu, 7 Mar 2019 17:40:56 +0800 Subject: [PATCH] Update default rust toolchain. --- .circleci/config.yml | 2 +- .travis.yml | 2 +- cita-auth/src/dispatcher.rs | 2 +- cita-auth/src/handler.rs | 6 +++--- cita-bft | 2 +- cita-chain/core/src/libchain/chain.rs | 17 ++++++++--------- cita-chain/types/src/filter.rs | 2 +- cita-chain/types/src/receipt.rs | 4 ++-- .../core/src/contracts/grpc/grpc_vm.rs | 2 +- .../src/contracts/native/crosschain_verify.rs | 2 +- cita-executor/core/src/libexecutor/lru_cache.rs | 2 +- cita-executor/src/backlogs.rs | 2 +- cita-forever | 2 +- daemon.sh | 2 +- env.sh | 2 +- scripts/ci.sh | 2 +- tools/create_key_addr/src/main.rs | 2 +- 17 files changed, 27 insertions(+), 28 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1de88a2c2..d33998bdc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,7 +107,7 @@ alias: - &job-default docker: - - image: cita/cita-build:ubuntu-18.04-20190107 + - image: cita/cita-build:ubuntu-18.04-20190304 working_directory: ~/cita-build resource_class: xlarge diff --git a/.travis.yml b/.travis.yml index 4f9fbfc3d..c4b3c74b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ stages: - Release - IntegrateTest before_install: - - docker pull cita/cita-build:ubuntu-18.04-20190107 + - docker pull cita/cita-build:ubuntu-18.04-20190304 jobs: include: diff --git a/cita-auth/src/dispatcher.rs b/cita-auth/src/dispatcher.rs index c7d078377..96374f023 100644 --- a/cita-auth/src/dispatcher.rs +++ b/cita-auth/src/dispatcher.rs @@ -153,7 +153,7 @@ impl Dispatcher { pub fn get_txs(&self, ids: &[H256]) -> Vec { let pool = self.txs_pool.borrow(); - ids.into_iter() + ids.iter() .map(|id| pool.get(id).cloned()) .filter(|tx| tx.is_some()) .map(|tx| tx.unwrap()) diff --git a/cita-auth/src/handler.rs b/cita-auth/src/handler.rs index f9fc3501c..1a138cb35 100644 --- a/cita-auth/src/handler.rs +++ b/cita-auth/src/handler.rs @@ -548,7 +548,7 @@ impl MsgHandler { fn deal_black_list(&mut self, black_list: &BlackList) { black_list .get_clear_list() - .into_iter() + .iter() .for_each(|clear_list: &Vec| { self.black_list_cache .remove(&Address::from_slice(clear_list.as_slice())); @@ -556,7 +556,7 @@ impl MsgHandler { black_list .get_black_list() - .into_iter() + .iter() .for_each(|blacklist: &Vec| { self.black_list_cache .entry(Address::from_slice(blacklist.as_slice())) @@ -857,7 +857,7 @@ impl MsgHandler { fn deal_get_block_txn(&mut self, get_block_txn: &mut GetBlockTxn, origin: Origin) { let short_ids: Vec = get_block_txn .get_short_ids() - .into_iter() + .iter() .map(|id| H256::from(U256::from(id.as_slice()))) .collect(); let txs: Vec = self diff --git a/cita-bft b/cita-bft index 893e97a69..f3360601a 160000 --- a/cita-bft +++ b/cita-bft @@ -1 +1 @@ -Subproject commit 893e97a69dfed64361a2009bc888b001adc8dcab +Subproject commit f3360601aee602559daa7fe1c3a80c2e0fab2a83 diff --git a/cita-chain/core/src/libchain/chain.rs b/cita-chain/core/src/libchain/chain.rs index b690a564c..46ce19a65 100644 --- a/cita-chain/core/src/libchain/chain.rs +++ b/cita-chain/core/src/libchain/chain.rs @@ -150,14 +150,13 @@ impl TxProof { let from_chain_id = U256::from(iter.next().unwrap()); let to_chain_id = U256::from(iter.next().unwrap()); let dest_contract = Address::from(H256::from(iter.next().unwrap())); - let dest_hasher = iter.next().unwrap()[..4] - .into_iter() - .take(4) - .enumerate() - .fold([0u8; 4], |mut acc, (idx, val)| { + let dest_hasher = iter.next().unwrap()[..4].iter().take(4).enumerate().fold( + [0u8; 4], + |mut acc, (idx, val)| { acc[idx] = *val; acc - }); + }, + ); let cross_chain_nonce = U256::from(iter.next().unwrap()).low_u64(); Some(RelayInfo { from_chain_id, @@ -459,12 +458,12 @@ impl Chain { let conf = ret.get_config(); let nodes = conf.get_nodes(); let nodes: Vec
= nodes - .into_iter() + .iter() .map(|vecaddr| Address::from_slice(&vecaddr[..])) .collect(); let validators = conf.get_validators(); let validators: Vec
= validators - .into_iter() + .iter() .map(|vecaddr| Address::from_slice(&vecaddr[..])) .collect(); let block_interval = conf.get_block_interval(); @@ -522,7 +521,7 @@ impl Chain { if !info.get_receipts().is_empty() { let receipts: Vec = info .get_receipts() - .into_iter() + .iter() .map(|receipt_with_option| Receipt::from(receipt_with_option.get_receipt().clone())) .collect(); diff --git a/cita-chain/types/src/filter.rs b/cita-chain/types/src/filter.rs index 3b6f89edb..fd05fdec3 100644 --- a/cita-chain/types/src/filter.rs +++ b/cita-chain/types/src/filter.rs @@ -82,7 +82,7 @@ impl Filter { .into_iter() .flat_map(|bloom| { topics - .into_iter() + .iter() .map(|topic| { let mut b = bloom; b.accrue_raw(topic); diff --git a/cita-chain/types/src/receipt.rs b/cita-chain/types/src/receipt.rs index e5d21b4fd..f3c4f67b1 100644 --- a/cita-chain/types/src/receipt.rs +++ b/cita-chain/types/src/receipt.rs @@ -254,12 +254,12 @@ impl From for Receipt { let logs = receipt .get_logs() - .into_iter() + .iter() .map(|log_entry| { let address: Address = Address::from_slice(log_entry.get_address()); let topics: Vec = log_entry .get_topics() - .into_iter() + .iter() .map(|topic| H256::from_slice(topic)) .collect(); let data: Bytes = Bytes::from(log_entry.get_data()); diff --git a/cita-executor/core/src/contracts/grpc/grpc_vm.rs b/cita-executor/core/src/contracts/grpc/grpc_vm.rs index ada9498d2..11296aa76 100644 --- a/cita-executor/core/src/contracts/grpc/grpc_vm.rs +++ b/cita-executor/core/src/contracts/grpc/grpc_vm.rs @@ -42,7 +42,7 @@ use util::Bytes; pub fn extract_logs_from_response(sender: Address, response: &InvokeResponse) -> Vec { response .get_logs() - .into_iter() + .iter() .map(|log| { let mut topics = Vec::new(); let tdata = log.get_topic(); diff --git a/cita-executor/core/src/contracts/native/crosschain_verify.rs b/cita-executor/core/src/contracts/native/crosschain_verify.rs index bf33e3fc9..191294ff1 100644 --- a/cita-executor/core/src/contracts/native/crosschain_verify.rs +++ b/cita-executor/core/src/contracts/native/crosschain_verify.rs @@ -116,7 +116,7 @@ impl CrossChainVerify { if result.is_none() { return Err(Error::Internal("decode 2nd param failed".to_string())); } - let hasher = result.unwrap()[..4].into_iter().take(4).enumerate().fold( + let hasher = result.unwrap()[..4].iter().take(4).enumerate().fold( [0u8; 4], |mut acc, (idx, val)| { acc[idx] = *val; diff --git a/cita-executor/core/src/libexecutor/lru_cache.rs b/cita-executor/core/src/libexecutor/lru_cache.rs index 578b2b2a2..17a94755e 100644 --- a/cita-executor/core/src/libexecutor/lru_cache.rs +++ b/cita-executor/core/src/libexecutor/lru_cache.rs @@ -96,7 +96,7 @@ where self.cache_by_key.remove(k); let v: Vec = v - .into_iter() + .iter() .filter(|value| match self.cache_by_value.get(value) { Some(ref key) if key == &k => true, None | Some(_) => false, diff --git a/cita-executor/src/backlogs.rs b/cita-executor/src/backlogs.rs index 69c23e8c4..efa6916c1 100644 --- a/cita-executor/src/backlogs.rs +++ b/cita-executor/src/backlogs.rs @@ -352,7 +352,7 @@ impl Backlogs { let executed_result = &self.completed[&prev_height]; let validators = executed_result.get_config().get_validators(); let proof_checkers: Vec
= validators - .into_iter() + .iter() .map(|vec| Address::from_slice(&vec[..])) .collect(); diff --git a/cita-forever b/cita-forever index e6f4b0d4f..5a4356ad5 160000 --- a/cita-forever +++ b/cita-forever @@ -1 +1 @@ -Subproject commit e6f4b0d4f4a90e5bdf524e84239187021e8830b4 +Subproject commit 5a4356ad5787993f7fa4ea5e965f1ce46a9c7412 diff --git a/daemon.sh b/daemon.sh index 3fe936cd2..dd30403c8 100755 --- a/daemon.sh +++ b/daemon.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -DOCKER_IMAGE="cita/cita-build:ubuntu-18.04-20190107" +DOCKER_IMAGE="cita/cita-build:ubuntu-18.04-20190304" if [[ `uname` == 'Darwin' ]] then cp /etc/localtime $PWD/localtime diff --git a/env.sh b/env.sh index 6d8fee58b..1f4ef735d 100755 --- a/env.sh +++ b/env.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -DOCKER_IMAGE="cita/cita-build:ubuntu-18.04-20190107" +DOCKER_IMAGE="cita/cita-build:ubuntu-18.04-20190304" if [[ `uname` == 'Darwin' ]] then cp /etc/localtime $PWD/localtime diff --git a/scripts/ci.sh b/scripts/ci.sh index b165fd666..b6b0a6ebc 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -DOCKER_IMAGE="cita/cita-build:ubuntu-18.04-20190107" +DOCKER_IMAGE="cita/cita-build:ubuntu-18.04-20190304" if [[ `uname` == 'Darwin' ]] then diff --git a/tools/create_key_addr/src/main.rs b/tools/create_key_addr/src/main.rs index fc75b9468..9bdd40189 100644 --- a/tools/create_key_addr/src/main.rs +++ b/tools/create_key_addr/src/main.rs @@ -25,7 +25,7 @@ use std::fs::{File, OpenOptions}; use std::io::Write; fn to_hex_string(data: &[u8]) -> String { - let strs: Vec = data.into_iter().map(|a| format!("{:02x}", a)).collect(); + let strs: Vec = data.iter().map(|a| format!("{:02x}", a)).collect(); strs.join("") }