From 52f6da5ceed2350ec6f8c7556ee3167cd3e658db Mon Sep 17 00:00:00 2001 From: Rob Walker Date: Fri, 23 Aug 2019 08:55:51 -0700 Subject: [PATCH] upgrade rust to 1.37 (#5611) --- .travis.yml | 2 +- README.md | 4 +--- ci/docker-rust/Dockerfile | 5 +---- ci/rust-version.sh | 4 ++-- ci/test-checks.sh | 2 +- core/src/banking_stage.rs | 2 ++ core/src/replicator.rs | 2 +- core/src/rpc_pubsub.rs | 1 + core/src/validator.rs | 4 ++-- runtime/src/accounts_index.rs | 4 ++-- 10 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9fa9a0b0f..af7103df6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ os: language: rust cache: cargo rust: - - 1.36.0 + - 1.37.0 install: - source ci/rust-version.sh diff --git a/README.md b/README.md index 1334a2b8d..13dd432b6 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ $ source $HOME/.cargo/env $ rustup component add rustfmt ``` -If your rustc version is lower than 1.36.0, please update it: +If your rustc version is lower than 1.37.0, please update it: ```bash $ rustup update @@ -240,5 +240,3 @@ problem is solved by this code?" On the other hand, if a test does fail and you better way to solve the same problem, a Pull Request with your solution would most certainly be welcome! Likewise, if rewriting a test can better communicate what code it's protecting, please send us that patch! - - diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile index 55465a6dd..2d4cb2b17 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/rust-version.sh to pick up the new image tag -FROM rust:1.36.0 +FROM rust:1.37.0 # Add Google Protocol Buffers for Libra's metrics library. ENV PROTOC_VERSION 3.8.0 @@ -10,9 +10,7 @@ RUN set -x \ && apt update \ && apt-get install apt-transport-https \ && echo deb https://apt.buildkite.com/buildkite-agent stable main > /etc/apt/sources.list.d/buildkite-agent.list \ - && echo deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-7 main > /etc/apt/sources.list.d/llvm.list \ && apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 32A37959C2FA5C3C99EFBC32A79206696452D198 \ - && wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ && apt update \ && apt install -y \ buildkite-agent \ @@ -20,7 +18,6 @@ RUN set -x \ cmake \ lcov \ libclang-common-7-dev \ - llvm-7 \ mscgen \ rsync \ sudo \ diff --git a/ci/rust-version.sh b/ci/rust-version.sh index e422f44d0..d9da6c873 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -13,8 +13,8 @@ # $ source ci/rust-version.sh # -stable_version=1.36.0 -nightly_version=2019-07-19 +stable_version=1.37.0 +nightly_version=2019-08-21 export rust_stable="$stable_version" export rust_stable_docker_image=solanalabs/rust:"$stable_version" diff --git a/ci/test-checks.sh b/ci/test-checks.sh index 7add714d0..e83fffe1f 100755 --- a/ci/test-checks.sh +++ b/ci/test-checks.sh @@ -18,7 +18,7 @@ _ cargo +"$rust_stable" clippy --version _ cargo +"$rust_stable" clippy --all --exclude solana-sdk-c -- --deny=warnings _ cargo +"$rust_stable" clippy --manifest-path sdk-c/Cargo.toml -- --deny=warnings -_ cargo +"$rust_stable" audit --version +# _ cargo +"$rust_stable" audit --version ### cargo-audit stopped supporting --version?? https://github.com/RustSec/cargo-audit/issues/100 _ cargo +"$rust_stable" audit _ ci/nits.sh _ ci/order-crates-for-publishing.py diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index d95397e33..13de283c6 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -198,6 +198,7 @@ impl BankingStage { if processed < verified_txs_len { let next_leader = poh_recorder.lock().unwrap().next_slot_leader(); // Walk thru rest of the transactions and filter out the invalid (e.g. too old) ones + #[allow(clippy::while_let_on_iterator)] while let Some((msgs, unprocessed_indexes)) = buffered_packets_iter.next() { let unprocessed_indexes = Self::filter_unprocessed_packets( &bank, @@ -849,6 +850,7 @@ impl BankingStage { if processed < verified_txs_len { let next_leader = poh.lock().unwrap().next_slot_leader(); // Walk thru rest of the transactions and filter out the invalid (e.g. too old) ones + #[allow(clippy::while_let_on_iterator)] while let Some((msgs, vers)) = mms_iter.next() { let packet_indexes = Self::generate_packet_indexes(vers); let unprocessed_indexes = Self::filter_unprocessed_packets( diff --git a/core/src/replicator.rs b/core/src/replicator.rs index c9e734667..27fa2fab2 100644 --- a/core/src/replicator.rs +++ b/core/src/replicator.rs @@ -46,7 +46,7 @@ use std::sync::{Arc, RwLock}; use std::thread::{sleep, spawn, JoinHandle}; use std::time::Duration; -static ENCRYPTED_FILENAME: &'static str = "ledger.enc"; +static ENCRYPTED_FILENAME: &str = "ledger.enc"; #[derive(Serialize, Deserialize)] pub enum ReplicatorRequest { diff --git a/core/src/rpc_pubsub.rs b/core/src/rpc_pubsub.rs index 4a7b19d77..9ce28bc9d 100644 --- a/core/src/rpc_pubsub.rs +++ b/core/src/rpc_pubsub.rs @@ -11,6 +11,7 @@ use solana_sdk::signature::Signature; use solana_sdk::transaction; use std::sync::{atomic, Arc}; +#[allow(clippy::needless_return)] // TODO remove me when rpc is updated? #[rpc(server)] pub trait RpcSolPubSub { type Metadata; diff --git a/core/src/validator.rs b/core/src/validator.rs index 6e93d789c..43d5e4f73 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -72,11 +72,11 @@ impl Default for ValidatorConfig { #[derive(Default)] pub struct ValidatorExit { - exits: Vec>, + exits: Vec>, } impl ValidatorExit { - pub fn register_exit(&mut self, exit: Box () + Send + Sync>) { + pub fn register_exit(&mut self, exit: Box () + Send + Sync>) { self.exits.push(exit); } diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index e0971c9dc..a8a5fdfb1 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -115,9 +115,9 @@ impl AccountsIndex { ); fork_vec.retain(|(fork, _)| !Self::can_purge(max_root, *fork)); - return None; + None } else { - return Some(account_info); + Some(account_info) } }