From 87699f8de031ffdb60646e150bf31223caa5e257 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Mon, 13 May 2019 15:10:25 +0200 Subject: [PATCH] fix(compilation warnings) (#10649) --- ethcore/src/client/client.rs | 2 +- ethcore/src/engines/clique/mod.rs | 5 ++--- ethcore/src/ethereum/ethash.rs | 2 +- parity/informant.rs | 2 +- rpc/src/tests/http_client.rs | 8 ++++---- rpc/src/v1/helpers/dispatch/prospective_signer.rs | 2 +- util/network-devp2p/src/host.rs | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 0c1dd86d4..bf980ac5f 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -273,7 +273,7 @@ impl Importer { let (imported_blocks, import_results, invalid_blocks, imported, proposed_blocks, duration, has_more_blocks_to_import) = { let mut imported_blocks = Vec::with_capacity(max_blocks_to_import); let mut invalid_blocks = HashSet::new(); - let mut proposed_blocks = Vec::with_capacity(max_blocks_to_import); + let proposed_blocks = Vec::with_capacity(max_blocks_to_import); let mut import_results = Vec::with_capacity(max_blocks_to_import); let _import_lock = self.import_lock.lock(); diff --git a/ethcore/src/engines/clique/mod.rs b/ethcore/src/engines/clique/mod.rs index b63bf76b2..1ae30905e 100644 --- a/ethcore/src/engines/clique/mod.rs +++ b/ethcore/src/engines/clique/mod.rs @@ -287,8 +287,7 @@ impl Clique { "Back-filling block state. last_checkpoint_number: {}, target: {}({}).", last_checkpoint_number, header.number(), header.hash()); - let mut chain: &mut VecDeque
= &mut VecDeque::with_capacity( - (header.number() - last_checkpoint_number + 1) as usize); + let mut chain = VecDeque::with_capacity((header.number() - last_checkpoint_number + 1) as usize); // Put ourselves in. chain.push_front(header.clone()); @@ -332,7 +331,7 @@ impl Clique { // Backfill! let mut new_state = last_checkpoint_state.clone(); - for item in chain { + for item in &chain { new_state.apply(item, false)?; } new_state.calc_next_timestamp(header.timestamp(), self.period)?; diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 1c47e114b..8a19d9a01 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -277,7 +277,7 @@ impl Engine for Arc { let n_uncles = block.uncles.len(); // Bestow block rewards. - let mut result_block_reward = reward + reward.shr(5) * U256::from(n_uncles); + let result_block_reward = reward + reward.shr(5) * U256::from(n_uncles); rewards.push((author, RewardKind::Author, result_block_reward)); diff --git a/parity/informant.rs b/parity/informant.rs index e0ba66f07..285557976 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -259,7 +259,7 @@ impl Informant { let elapsed = now.duration_since(*self.last_tick.read()); let (client_report, full_report) = { - let mut last_report = self.last_report.lock(); + let last_report = self.last_report.lock(); let full_report = self.target.report(); let diffed = full_report.client_report.clone() - &*last_report; (diffed, full_report) diff --git a/rpc/src/tests/http_client.rs b/rpc/src/tests/http_client.rs index 0588c791e..38f2ae93c 100644 --- a/rpc/src/tests/http_client.rs +++ b/rpc/src/tests/http_client.rs @@ -113,20 +113,20 @@ pub fn request(address: &SocketAddr, request: &str) -> Response { pub fn assert_security_headers_present(headers: &[String], port: Option) { if port.is_none() { assert!( - headers.iter().any(|header| header.as_str() == "X-Frame-Options: SAMEORIGIN") + headers.iter().any(|header| header.as_str() == "X-Frame-Options: SAMEORIGIN"), "X-Frame-Options: SAMEORIGIN missing: {:?}", headers ); } assert!( - headers.iter().any(|header| header.as_str() == "X-XSS-Protection: 1; mode=block") + headers.iter().any(|header| header.as_str() == "X-XSS-Protection: 1; mode=block"), "X-XSS-Protection missing: {:?}", headers ); assert!( - headers.iter().any(|header| header.as_str() == "X-Content-Type-Options: nosniff") + headers.iter().any(|header| header.as_str() == "X-Content-Type-Options: nosniff"), "X-Content-Type-Options missing: {:?}", headers ); assert!( - headers.iter().any(|header| header.starts_with("Content-Security-Policy: ")) + headers.iter().any(|header| header.starts_with("Content-Security-Policy: ")), "Content-Security-Policy missing: {:?}", headers ) } diff --git a/rpc/src/v1/helpers/dispatch/prospective_signer.rs b/rpc/src/v1/helpers/dispatch/prospective_signer.rs index 034d19dc6..6d4b47089 100644 --- a/rpc/src/v1/helpers/dispatch/prospective_signer.rs +++ b/rpc/src/v1/helpers/dispatch/prospective_signer.rs @@ -129,7 +129,7 @@ impl Future for ProspectiveSigner

{ .into_future()); }, WaitForPostSign => { - if let Some(mut fut) = self.post_sign_future.as_mut() { + if let Some(fut) = self.post_sign_future.as_mut() { match fut.poll()? { Async::Ready(item) => { let nonce = self.ready diff --git a/util/network-devp2p/src/host.rs b/util/network-devp2p/src/host.rs index 3dc107d2b..5f0969751 100644 --- a/util/network-devp2p/src/host.rs +++ b/util/network-devp2p/src/host.rs @@ -616,7 +616,7 @@ impl Host { let socket = { let address = { - let mut nodes = self.nodes.read(); + let nodes = self.nodes.read(); if let Some(node) = nodes.get(id) { node.endpoint.address } else {