diff --git a/ci/docker-rust-nightly/README.md b/ci/docker-rust-nightly/README.md index 63f8c2875ffafe..f4e7931f3d8511 100644 --- a/ci/docker-rust-nightly/README.md +++ b/ci/docker-rust-nightly/README.md @@ -20,7 +20,7 @@ To update the pinned version: specific YYYY-MM-DD that is desired (default is today's build). Check https://rust-lang.github.io/rustup-components-history/ for build status -1. Update `ci/rust-version.sh` to reflect the new nightly `YYY-MM-DD` +1. Update `ci/rust-version.sh` to reflect the new nightly `YYYY-MM-DD` 1. Run `SOLANA_ALLOCATE_TTY=1 SOLANA_DOCKER_RUN_NOSETUID=1 ci/docker-run.sh --nopull solanalabs/rust-nightly:YYYY-MM-DD ci/test-checks.sh` and `SOLANA_ALLOCATE_TTY=1 SOLANA_DOCKER_RUN_NOSETUID=1 ci/docker-run.sh --nopull solanalabs/rust-nightly:YYYY-MM-DD ci/test-coverage.sh [args]...` to confirm the new nightly image builds. Fix any issues as needed diff --git a/ci/rust-version.sh b/ci/rust-version.sh index 7910f4cd3cbc4f..70bbe8e3bbf2d8 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -24,7 +24,7 @@ fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else - nightly_version=2020-07-27 + nightly_version=2020-08-17 fi diff --git a/ci/test-checks.sh b/ci/test-checks.sh index 4ddde2fc340507..10cb4649d40fd0 100755 --- a/ci/test-checks.sh +++ b/ci/test-checks.sh @@ -53,7 +53,9 @@ _ cargo +"$rust_stable" fmt --all -- --check # -Z... is needed because of clippy bug: https://github.com/rust-lang/rust-clippy/issues/4612 # run nightly clippy for `sdk/` as there's a moderate amount of nightly-only code there -_ cargo +"$rust_nightly" clippy -Zunstable-options --workspace --all-targets -- --deny=warnings +_ cargo +"$rust_nightly" clippy \ + -Zunstable-options --workspace --all-targets \ + -- --deny=warnings --allow=clippy::stable_sort_primitive _ scripts/cargo-for-all-lock-files.sh +"$rust_stable" audit --ignore RUSTSEC-2020-0002 --ignore RUSTSEC-2020-0008 diff --git a/core/benches/banking_stage.rs b/core/benches/banking_stage.rs index 0004ce92afd335..3cd5465c6d1125 100644 --- a/core/benches/banking_stage.rs +++ b/core/benches/banking_stage.rs @@ -109,6 +109,7 @@ fn make_accounts_txs(txes: usize, mint_keypair: &Keypair, hash: Hash) -> Vec Vec { let progs = 4; (0..txes) @@ -294,6 +295,7 @@ fn simulate_process_entries( process_entries(&bank, &[entry], randomize_txs, None, None).unwrap(); } +#[allow(clippy::same_item_push)] fn bench_process_entries(randomize_txs: bool, bencher: &mut Bencher) { // entropy multiplier should be big enough to provide sufficient entropy // but small enough to not take too much time while executing the test. diff --git a/core/benches/retransmit_stage.rs b/core/benches/retransmit_stage.rs index c855f3d940c303..65bdc0d7ef638a 100644 --- a/core/benches/retransmit_stage.rs +++ b/core/benches/retransmit_stage.rs @@ -27,6 +27,7 @@ use std::time::Duration; use test::Bencher; #[bench] +#[allow(clippy::same_item_push)] fn bench_retransmitter(bencher: &mut Bencher) { solana_logger::setup(); let cluster_info = ClusterInfo::new_with_invalid_keypair(Node::new_localhost().info); diff --git a/core/src/broadcast_stage.rs b/core/src/broadcast_stage.rs index 4cf7c866e9e99d..04970cd7022148 100644 --- a/core/src/broadcast_stage.rs +++ b/core/src/broadcast_stage.rs @@ -203,6 +203,7 @@ impl BroadcastStage { /// which will then close FetchStage in the Tpu, and then the rest of the Tpu, /// completing the cycle. #[allow(clippy::too_many_arguments)] + #[allow(clippy::same_item_push)] fn new( socks: Vec, cluster_info: Arc, diff --git a/core/src/cluster_info.rs b/core/src/cluster_info.rs index bae3fdf3f8d76c..6a40f2a477b0fc 100644 --- a/core/src/cluster_info.rs +++ b/core/src/cluster_info.rs @@ -3345,6 +3345,7 @@ mod tests { } #[test] + #[allow(clippy::same_item_push)] fn test_push_epoch_slots_large() { use rand::Rng; let node_keypair = Arc::new(Keypair::new()); diff --git a/core/src/epoch_slots.rs b/core/src/epoch_slots.rs index 758c21e596e4dd..ed325d34c5a964 100644 --- a/core/src/epoch_slots.rs +++ b/core/src/epoch_slots.rs @@ -451,6 +451,7 @@ mod tests { } #[test] + #[allow(clippy::same_item_push)] fn test_epoch_slots_fill_uncompressed_random_range() { use rand::Rng; for _ in 0..10 { @@ -469,6 +470,7 @@ mod tests { } #[test] + #[allow(clippy::same_item_push)] fn test_epoch_slots_fill_compressed_random_range() { use rand::Rng; for _ in 0..10 { @@ -489,6 +491,7 @@ mod tests { } #[test] + #[allow(clippy::same_item_push)] fn test_epoch_slots_fill_random_range() { use rand::Rng; for _ in 0..10 { diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 82cd9a551e037a..20bdcef85221df 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -6600,6 +6600,7 @@ pub mod tests { } #[test] + #[allow(clippy::same_item_push)] fn test_get_last_hash() { let mut entries: Vec = vec![]; let empty_entries_iterator = entries.iter(); diff --git a/ledger/src/entry.rs b/ledger/src/entry.rs index b22d540ab58838..d0c63bfd82e882 100644 --- a/ledger/src/entry.rs +++ b/ledger/src/entry.rs @@ -638,6 +638,7 @@ pub fn next_entry_mut(start: &mut Hash, num_hashes: u64, transactions: Vec Vec { let mut ticks = Vec::with_capacity(num_ticks as usize); for _ in 0..num_ticks { @@ -648,6 +649,7 @@ pub fn create_ticks(num_ticks: u64, hashes_per_tick: u64, mut hash: Hash) -> Vec ticks } +#[allow(clippy::same_item_push)] pub fn create_random_ticks(num_ticks: u64, max_hashes_per_tick: u64, mut hash: Hash) -> Vec { let mut ticks = Vec::with_capacity(num_ticks as usize); for _ in 0..num_ticks { diff --git a/programs/vote/src/vote_instruction.rs b/programs/vote/src/vote_instruction.rs index 5df237758d33f1..ad1cccdff95072 100644 --- a/programs/vote/src/vote_instruction.rs +++ b/programs/vote/src/vote_instruction.rs @@ -331,6 +331,7 @@ mod tests { ); } + #[allow(clippy::same_item_push)] fn process_instruction(instruction: &Instruction) -> Result<(), InstructionError> { let mut accounts: Vec<_> = instruction .accounts diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index b774c8898ba0ea..24465508fc031c 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -1966,6 +1966,7 @@ impl Bank { } } + #[allow(clippy::needless_collect)] fn distribute_rent_to_validators( &self, vote_account_hashmap: &HashMap, diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index dbdf95a3ad8c38..1774dd189b5ccc 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -92,7 +92,7 @@ impl SnapshotVersion { } } -#[derive(PartialEq, Ord, Eq, Debug)] +#[derive(PartialEq, Eq, Debug)] pub struct SlotSnapshotPaths { pub slot: Slot, pub snapshot_file_path: PathBuf, @@ -126,6 +126,12 @@ impl PartialOrd for SlotSnapshotPaths { } } +impl Ord for SlotSnapshotPaths { + fn cmp(&self, other: &Self) -> Ordering { + self.slot.cmp(&other.slot) + } +} + impl SlotSnapshotPaths { fn copy_snapshot_directory>(&self, snapshot_hardlink_dir: P) -> Result<()> { // Create a new directory in snapshot_hardlink_dir diff --git a/sdk/src/pubkey.rs b/sdk/src/pubkey.rs index 3807ea502c3501..62032185b7bd52 100644 --- a/sdk/src/pubkey.rs +++ b/sdk/src/pubkey.rs @@ -158,8 +158,9 @@ impl Pubkey { /// Find a valid program address and its corresponding nonce which must be passed /// as an additional seed when calling `create_program_address` // #[cfg(not(feature = "program"))] + #[allow(clippy::same_item_push)] pub fn find_program_address(seeds: &[&[u8]], program_id: &Pubkey) -> (Pubkey, u8) { - let mut nonce = [255]; + let mut nonce = [std::u8::MAX]; for _ in 0..std::u8::MAX { { let mut seeds_with_nonce = seeds.to_vec(); diff --git a/transaction-status/src/parse_token.rs b/transaction-status/src/parse_token.rs index 84db788b71f711..049fab9c3ed027 100644 --- a/transaction-status/src/parse_token.rs +++ b/transaction-status/src/parse_token.rs @@ -311,6 +311,7 @@ mod test { } #[test] + #[allow(clippy::same_item_push)] fn test_parse_token() { let mut keys: Vec = vec![]; for _ in 0..10 { @@ -656,6 +657,7 @@ mod test { } #[test] + #[allow(clippy::same_item_push)] fn test_token_ix_not_enough_keys() { let mut keys: Vec = vec![]; for _ in 0..10 {