From 80f35680621f0046ab53217205cba586c6afe25e Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Mon, 15 Apr 2019 15:56:08 -0600 Subject: [PATCH] Upgrade to Rust 1.34.0 (#3781) * Upgrade to Rust 1.34.0 * Remove redundant closures Thanks Clippy! --- README.md | 2 +- ci/docker-rust/Dockerfile | 2 +- ci/rust-version.sh | 4 ++-- core/src/cluster_info.rs | 6 +++--- core/src/entry.rs | 2 +- fullnode/src/main.rs | 2 +- install/src/main.rs | 2 +- runtime/src/accounts.rs | 2 +- sdk/src/transaction.rs | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8a63d7b2a..6ec7cba1f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ $ source $HOME/.cargo/env $ rustup component add rustfmt-preview ``` -If your rustc version is lower than 1.33.0, please update it: +If your rustc version is lower than 1.34.0, please update it: ```bash $ rustup update diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile index 1e2ac1d63..7b0d7e089 100644 --- a/ci/docker-rust/Dockerfile +++ b/ci/docker-rust/Dockerfile @@ -1,6 +1,6 @@ # Note: when the rust version is changed also modify # ci/buildkite.yml to pick up the new image tag -FROM rust:1.33.0 +FROM rust:1.34.0 RUN set -x \ && apt update \ diff --git a/ci/rust-version.sh b/ci/rust-version.sh index 9adbb704b..4a40f94f0 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -13,8 +13,8 @@ # $ source ci/rust-version.sh # -export rust_stable=1.33.0 -export rust_stable_docker_image=solanalabs/rust:1.33.0 +export rust_stable=1.34.0 +export rust_stable_docker_image=solanalabs/rust:1.34.0 export rust_nightly=nightly-2019-03-14 export rust_nightly_docker_image=solanalabs/rust-nightly:2019-03-14 diff --git a/core/src/cluster_info.rs b/core/src/cluster_info.rs index 3ea168444..3ab0a5037 100644 --- a/core/src/cluster_info.rs +++ b/core/src/cluster_info.rs @@ -227,7 +227,7 @@ impl ClusterInfo { self.gossip .crds .lookup(&entry) - .and_then(|x| x.contact_info()) + .and_then(CrdsValue::contact_info) } pub fn my_data(&self) -> ContactInfo { @@ -847,7 +847,7 @@ impl ClusterInfo { self.gossip .crds .lookup(&peer_label) - .and_then(|v| v.contact_info()) + .and_then(CrdsValue::contact_info) .map(|peer_info| (peer, filter, peer_info.gossip, self_info)) }) .collect(); @@ -873,7 +873,7 @@ impl ClusterInfo { self.gossip .crds .lookup(&peer_label) - .and_then(|v| v.contact_info()) + .and_then(CrdsValue::contact_info) .map(|p| p.gossip) }) .map(|peer| (peer, Protocol::PushMessage(self_id, msgs.clone()))) diff --git a/core/src/entry.rs b/core/src/entry.rs index f1a222235..62fdd421d 100644 --- a/core/src/entry.rs +++ b/core/src/entry.rs @@ -265,7 +265,7 @@ impl EntrySlice for [Entry] { } fn to_single_entry_blobs(&self) -> Vec { - self.iter().map(|entry| entry.to_blob()).collect() + self.iter().map(Entry::to_blob).collect() } } diff --git a/fullnode/src/main.rs b/fullnode/src/main.rs index 1a7e7b1da..e4fca4ec4 100644 --- a/fullnode/src/main.rs +++ b/fullnode/src/main.rs @@ -229,7 +229,7 @@ fn main() { (Some(signer_service), signer_addr) }; let init_complete_file = matches.value_of("init_complete_file"); - fullnode_config.blockstream = matches.value_of("blockstream").map(|s| s.to_string()); + fullnode_config.blockstream = matches.value_of("blockstream").map(ToString::to_string); let keypair = Arc::new(keypair); let mut node = Node::new_with_external_ip(&keypair.pubkey(), &gossip_addr, dynamic_port_range); diff --git a/install/src/main.rs b/install/src/main.rs index 1c0531bcd..399f049b5 100644 --- a/install/src/main.rs +++ b/install/src/main.rs @@ -213,7 +213,7 @@ fn main() -> Result<(), String> { let program_name = matches.value_of("program_name").unwrap(); let program_arguments = matches .values_of("program_arguments") - .map(|iter| iter.collect()) + .map(Iterator::collect) .unwrap_or_else(|| vec![]); command::run(config_file, program_name, program_arguments) diff --git a/runtime/src/accounts.rs b/runtime/src/accounts.rs index 847cd0bcb..6610f5290 100644 --- a/runtime/src/accounts.rs +++ b/runtime/src/accounts.rs @@ -214,7 +214,7 @@ pub struct Accounts { } fn get_paths_vec(paths: &str) -> Vec { - paths.split(',').map(|s| s.to_string()).collect() + paths.split(',').map(ToString::to_string).collect() } impl Drop for Accounts { diff --git a/sdk/src/transaction.rs b/sdk/src/transaction.rs index e567e0dfc..2a66c5f0c 100644 --- a/sdk/src/transaction.rs +++ b/sdk/src/transaction.rs @@ -109,7 +109,7 @@ impl Transaction { ) -> Self { let mut account_keys: Vec<_> = from_keypairs .iter() - .map(|keypair| keypair.pubkey()) + .map(|keypair| (*keypair).pubkey()) .collect(); account_keys.extend_from_slice(keys); let message = Message::new_with_compiled_instructions(