From 6e5e1721f7445c34d8ca2c4050622ccf7825324f Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 28 May 2019 10:46:01 +1000 Subject: [PATCH] Fix lints introduced in Rust 1.35 --- beacon_node/client/src/client_config.rs | 2 +- eth2/fork_choice/src/bitwise_lmd_ghost.rs | 7 ++++--- eth2/fork_choice/src/optimized_lmd_ghost.rs | 7 ++++--- validator_client/src/error.rs | 5 +---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/beacon_node/client/src/client_config.rs b/beacon_node/client/src/client_config.rs index 243848e9f..d8d3f2c4a 100644 --- a/beacon_node/client/src/client_config.rs +++ b/beacon_node/client/src/client_config.rs @@ -98,7 +98,7 @@ impl ClientConfig { // Custom bootnodes if let Some(boot_addresses_str) = args.value_of("boot-nodes") { - let mut boot_addresses_split = boot_addresses_str.split(","); + let boot_addresses_split = boot_addresses_str.split(","); for boot_address in boot_addresses_split { if let Ok(boot_address) = boot_address.parse::() { config.net_conf.boot_nodes.append(&mut vec![boot_address]); diff --git a/eth2/fork_choice/src/bitwise_lmd_ghost.rs b/eth2/fork_choice/src/bitwise_lmd_ghost.rs index a26a94b8a..129dca985 100644 --- a/eth2/fork_choice/src/bitwise_lmd_ghost.rs +++ b/eth2/fork_choice/src/bitwise_lmd_ghost.rs @@ -124,8 +124,9 @@ impl BitwiseLMDGhost { [log2_int((block_height - target_height - 1u64).as_u64()) as usize] .get(&block_hash) //TODO: Panic if we can't lookup and fork choice fails - .expect("All blocks should be added to the ancestor log lookup table"); - self.get_ancestor(*ancestor_lookup, target_height, &spec) + .expect("All blocks should be added to the ancestor log lookup table") + .clone(); + self.get_ancestor(ancestor_lookup, target_height, &spec) } { // add the result to the cache self.cache.insert(cache_key, ancestor); @@ -151,7 +152,7 @@ impl BitwiseLMDGhost { // these have already been weighted by balance for (hash, votes) in latest_votes.iter() { if let Some(ancestor) = self.get_ancestor(*hash, block_height, spec) { - let current_vote_value = current_votes.get(&ancestor).unwrap_or_else(|| &0); + let current_vote_value = current_votes.get(&ancestor).unwrap_or_else(|| &0).clone(); current_votes.insert(ancestor, current_vote_value + *votes); total_vote_count += votes; } diff --git a/eth2/fork_choice/src/optimized_lmd_ghost.rs b/eth2/fork_choice/src/optimized_lmd_ghost.rs index 2c1063a2b..351c4decd 100644 --- a/eth2/fork_choice/src/optimized_lmd_ghost.rs +++ b/eth2/fork_choice/src/optimized_lmd_ghost.rs @@ -124,8 +124,9 @@ impl OptimizedLMDGhost { [log2_int((block_height - target_height - 1u64).as_u64()) as usize] .get(&block_hash) //TODO: Panic if we can't lookup and fork choice fails - .expect("All blocks should be added to the ancestor log lookup table"); - self.get_ancestor(*ancestor_lookup, target_height, &spec) + .expect("All blocks should be added to the ancestor log lookup table") + .clone(); + self.get_ancestor(ancestor_lookup, target_height, &spec) } { // add the result to the cache self.cache.insert(cache_key, ancestor); @@ -151,7 +152,7 @@ impl OptimizedLMDGhost { // these have already been weighted by balance for (hash, votes) in latest_votes.iter() { if let Some(ancestor) = self.get_ancestor(*hash, block_height, spec) { - let current_vote_value = current_votes.get(&ancestor).unwrap_or_else(|| &0); + let current_vote_value = current_votes.get(&ancestor).unwrap_or_else(|| &0).clone(); current_votes.insert(ancestor, current_vote_value + *votes); total_vote_count += votes; } diff --git a/validator_client/src/error.rs b/validator_client/src/error.rs index 29d7ba882..97500f900 100644 --- a/validator_client/src/error.rs +++ b/validator_client/src/error.rs @@ -1,9 +1,6 @@ use slot_clock; -use error_chain::{ - error_chain, error_chain_processing, impl_error_chain_kind, impl_error_chain_processed, - impl_extract_backtrace, -}; +use error_chain::error_chain; error_chain! { links { }