From 9e703f85de4184f577f22a1c72a0d33612f2feb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Fri, 1 Sep 2023 09:26:13 +0200 Subject: [PATCH] Upgrades Rust to 1.72.0 & nightly-2023-08-25 (#32961) * allow pedantic invalid cast lint * allow lint with false-positive triggered by `test-case` crate * nightly `fmt` correction * adapt to rust layout changes * remove dubious test * Use transmute instead of pointer cast and de/ref when check_aligned is false. * Renames clippy::integer_arithmetic to clippy::arithmetic_side_effects. * bump rust nightly to 2023-08-25 * Upgrades Rust to 1.72.0 --------- Co-authored-by: Trent Nelson --- account-decoder/src/lib.rs | 2 +- accounts-bench/src/main.rs | 2 +- accounts-cluster-bench/src/main.rs | 2 +- accounts-db/src/append_vec.rs | 2 + accounts-db/src/lib.rs | 2 +- banking-bench/src/main.rs | 2 +- banks-server/src/lib.rs | 2 +- bench-streamer/src/main.rs | 2 +- bench-tps/src/lib.rs | 2 +- bench-tps/src/main.rs | 2 +- bench-tps/tests/bench_tps.rs | 2 +- bucket_map/src/lib.rs | 2 +- ci/docker-rust-nightly/Dockerfile | 2 +- ci/docker-rust/Dockerfile | 2 +- ci/rust-version.sh | 2 +- ci/test-checks.sh | 4 +- cli-output/src/lib.rs | 2 +- cli/src/lib.rs | 2 +- cli/tests/nonce.rs | 2 +- cli/tests/program.rs | 2 +- cli/tests/request_airdrop.rs | 2 +- cli/tests/stake.rs | 2 +- cli/tests/transfer.rs | 2 +- cli/tests/vote.rs | 2 +- client/src/lib.rs | 2 +- client/src/transaction_executor.rs | 2 +- connection-cache/src/lib.rs | 2 +- core/benches/banking_stage.rs | 2 +- core/benches/consumer.rs | 2 +- core/benches/shredder.rs | 2 +- core/benches/sigverify_stage.rs | 2 +- core/src/lib.rs | 2 +- core/tests/epoch_accounts_hash.rs | 5 ++- core/tests/fork-selection.rs | 2 +- core/tests/ledger_cleanup.rs | 2 +- core/tests/snapshots.rs | 2 +- cost-model/src/lib.rs | 2 +- dos/src/lib.rs | 2 +- dos/src/main.rs | 2 +- download-utils/src/lib.rs | 2 +- entry/src/lib.rs | 2 +- genesis/src/lib.rs | 2 +- genesis/src/main.rs | 2 +- gossip/src/lib.rs | 2 +- gossip/tests/crds_gossip.rs | 2 +- gossip/tests/gossip.rs | 2 +- install/src/lib.rs | 2 +- keygen/src/keygen.rs | 2 +- ledger-tool/src/main.rs | 2 +- ledger/benches/blockstore.rs | 2 +- ledger/benches/protobuf.rs | 2 +- ledger/src/lib.rs | 2 +- ledger/tests/shred.rs | 2 +- local-cluster/src/lib.rs | 2 +- local-cluster/tests/local_cluster.rs | 2 +- log-analyzer/src/main.rs | 2 +- measure/src/lib.rs | 2 +- memory-management/src/aligned_memory.rs | 2 +- memory-management/src/lib.rs | 2 +- merkle-tree/src/lib.rs | 2 +- metrics/src/lib.rs | 2 +- net-shaper/src/main.rs | 2 +- net-utils/src/lib.rs | 2 +- perf/benches/dedup.rs | 2 +- perf/benches/shrink.rs | 2 +- perf/src/deduper.rs | 4 +- perf/src/sigverify.rs | 2 +- poh-bench/src/main.rs | 2 +- poh/src/lib.rs | 2 +- program-runtime/src/lib.rs | 2 +- program-test/src/lib.rs | 2 +- program-test/tests/warp.rs | 2 +- programs/bpf_loader/src/lib.rs | 2 +- programs/bpf_loader/src/serialization.rs | 2 +- programs/bpf_loader/src/syscalls/cpi.rs | 2 +- programs/bpf_loader/src/syscalls/mod.rs | 12 +++--- programs/config/src/lib.rs | 2 +- programs/sbf/benches/bpf_loader.rs | 2 +- programs/sbf/rust/128bit/src/lib.rs | 2 +- programs/sbf/rust/128bit_dep/src/lib.rs | 2 +- programs/sbf/rust/alloc/src/lib.rs | 2 +- programs/sbf/rust/custom_heap/src/lib.rs | 2 +- .../sbf/rust/deprecated_loader/src/lib.rs | 2 +- programs/sbf/rust/dup_accounts/src/lib.rs | 2 +- programs/sbf/rust/external_spend/src/lib.rs | 2 +- programs/sbf/rust/invoked/src/processor.rs | 2 +- programs/sbf/rust/iter/src/lib.rs | 2 +- programs/sbf/rust/many_args/src/helper.rs | 2 +- programs/sbf/rust/many_args_dep/src/lib.rs | 2 +- .../sbf/rust/param_passing_dep/src/lib.rs | 2 +- programs/sbf/rust/sanity/src/lib.rs | 2 +- .../rust/sibling_inner_instruction/src/lib.rs | 2 +- programs/sbf/rust/simulation/src/lib.rs | 2 +- programs/sbf/rust/spoof1_system/src/lib.rs | 2 +- programs/stake/src/lib.rs | 2 +- programs/system/src/lib.rs | 2 +- pubsub-client/src/lib.rs | 2 +- quic-client/src/lib.rs | 2 +- remote-wallet/src/lib.rs | 2 +- rpc-client-api/src/lib.rs | 2 +- rpc-client/src/lib.rs | 2 +- rpc/src/lib.rs | 2 +- runtime/benches/accounts.rs | 2 +- runtime/benches/bank.rs | 2 +- runtime/src/lib.rs | 2 +- runtime/tests/stake.rs | 2 +- rust-toolchain.toml | 2 +- sdk/benches/accounts.rs | 2 +- sdk/gen-headers/src/main.rs | 2 +- sdk/program/src/account_info.rs | 1 + sdk/program/src/borsh0_10.rs | 2 +- sdk/program/src/borsh0_9.rs | 2 +- sdk/program/src/entrypoint.rs | 4 +- sdk/program/src/entrypoint_deprecated.rs | 2 +- sdk/program/src/fee_calculator.rs | 2 +- sdk/program/src/instruction.rs | 41 +------------------ sdk/program/src/lib.rs | 2 +- sdk/program/src/message/legacy.rs | 4 +- sdk/program/src/native_token.rs | 2 +- sdk/program/src/program.rs | 2 +- sdk/program/src/program_error.rs | 2 +- sdk/program/src/program_stubs.rs | 2 +- sdk/program/src/pubkey.rs | 2 +- sdk/program/src/rent.rs | 2 +- sdk/program/src/serde_varint.rs | 6 +-- sdk/program/src/serialize_utils.rs | 2 +- sdk/program/src/short_vec.rs | 2 +- sdk/program/src/slot_history.rs | 2 +- sdk/program/src/stake/state.rs | 2 +- sdk/program/src/sysvar/instructions.rs | 2 +- sdk/program/src/sysvar/recent_blockhashes.rs | 2 +- .../src/vote/state/vote_state_0_23_5.rs | 2 +- sdk/src/offchain_message.rs | 2 +- sdk/src/shred_version.rs | 2 +- sdk/src/transaction/sanitized.rs | 2 +- send-transaction-service/src/lib.rs | 2 +- stake-accounts/src/main.rs | 2 +- storage-bigtable/src/lib.rs | 2 +- streamer/src/lib.rs | 2 +- test-validator/src/lib.rs | 2 +- thin-client/src/lib.rs | 2 +- tokens/src/lib.rs | 2 +- tpu-client/src/lib.rs | 2 +- transaction-dos/src/main.rs | 2 +- transaction-status/src/lib.rs | 2 +- turbine/src/lib.rs | 2 +- udp-client/src/lib.rs | 2 +- validator/src/lib.rs | 2 +- validator/src/main.rs | 2 +- watchtower/src/main.rs | 2 +- zk-token-sdk/src/lib.rs | 2 +- 151 files changed, 167 insertions(+), 198 deletions(-) diff --git a/account-decoder/src/lib.rs b/account-decoder/src/lib.rs index cfba601a7a..9905e15f53 100644 --- a/account-decoder/src/lib.rs +++ b/account-decoder/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[macro_use] extern crate lazy_static; #[macro_use] diff --git a/accounts-bench/src/main.rs b/accounts-bench/src/main.rs index c7e75bc4c0..c439a6dd11 100644 --- a/accounts-bench/src/main.rs +++ b/accounts-bench/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[macro_use] extern crate log; diff --git a/accounts-cluster-bench/src/main.rs b/accounts-cluster-bench/src/main.rs index 06e535cdc2..9e592131a1 100644 --- a/accounts-cluster-bench/src/main.rs +++ b/accounts-cluster-bench/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { clap::{crate_description, crate_name, value_t, values_t_or_exit, App, Arg}, log::*, diff --git a/accounts-db/src/append_vec.rs b/accounts-db/src/append_vec.rs index 7c51e48529..765fa97fdc 100644 --- a/accounts-db/src/append_vec.rs +++ b/accounts-db/src/append_vec.rs @@ -694,6 +694,7 @@ pub mod tests { fn set_data_len_unsafe(&self, new_data_len: u64) { // UNSAFE: cast away & (= const ref) to &mut to force to mutate append-only (=read-only) AppendVec unsafe { + #[allow(invalid_reference_casting)] std::ptr::write( std::mem::transmute::<*const u64, *mut u64>(&self.meta.data_len), new_data_len, @@ -711,6 +712,7 @@ pub mod tests { fn set_executable_as_byte(&self, new_executable_byte: u8) { // UNSAFE: Force to interpret mmap-backed &bool as &u8 to write some crafted value; unsafe { + #[allow(invalid_reference_casting)] std::ptr::write( std::mem::transmute::<*const bool, *mut u8>(&self.account_meta.executable), new_executable_byte, diff --git a/accounts-db/src/lib.rs b/accounts-db/src/lib.rs index 8f62ea8ffa..1bf8ecd3d2 100644 --- a/accounts-db/src/lib.rs +++ b/accounts-db/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[macro_use] extern crate lazy_static; diff --git a/banking-bench/src/main.rs b/banking-bench/src/main.rs index e6ac6c4150..5d402592ad 100644 --- a/banking-bench/src/main.rs +++ b/banking-bench/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { clap::{crate_description, crate_name, Arg, ArgEnum, Command}, crossbeam_channel::{unbounded, Receiver}, diff --git a/banks-server/src/lib.rs b/banks-server/src/lib.rs index e8dc9f5e31..2ea4c4460f 100644 --- a/banks-server/src/lib.rs +++ b/banks-server/src/lib.rs @@ -1,2 +1,2 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod banks_server; diff --git a/bench-streamer/src/main.rs b/bench-streamer/src/main.rs index 1cf1951049..987df41134 100644 --- a/bench-streamer/src/main.rs +++ b/bench-streamer/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { clap::{crate_description, crate_name, Arg, Command}, diff --git a/bench-tps/src/lib.rs b/bench-tps/src/lib.rs index 5226b4e56f..7da3979a30 100644 --- a/bench-tps/src/lib.rs +++ b/bench-tps/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod bench; pub mod bench_tps_client; pub mod cli; diff --git a/bench-tps/src/main.rs b/bench-tps/src/main.rs index 756da9ce73..7969c402f0 100644 --- a/bench-tps/src/main.rs +++ b/bench-tps/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { clap::value_t, log::*, diff --git a/bench-tps/tests/bench_tps.rs b/bench-tps/tests/bench_tps.rs index 9263532c00..6111d550a3 100644 --- a/bench-tps/tests/bench_tps.rs +++ b/bench-tps/tests/bench_tps.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { serial_test::serial, diff --git a/bucket_map/src/lib.rs b/bucket_map/src/lib.rs index a61cae4e36..97c29547ad 100644 --- a/bucket_map/src/lib.rs +++ b/bucket_map/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] mod bucket; pub mod bucket_api; mod bucket_item; diff --git a/ci/docker-rust-nightly/Dockerfile b/ci/docker-rust-nightly/Dockerfile index 3f2703b5f4..fbd0903a07 100644 --- a/ci/docker-rust-nightly/Dockerfile +++ b/ci/docker-rust-nightly/Dockerfile @@ -1,4 +1,4 @@ -FROM solanalabs/rust:1.69.0 +FROM solanalabs/rust:1.72.0 ARG date RUN set -x \ diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile index ab93615468..07fb9e973e 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.69.0 +FROM rust:1.72.0 RUN set -x \ && apt update \ diff --git a/ci/rust-version.sh b/ci/rust-version.sh index 2b43b606de..1baaf19fc7 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -29,7 +29,7 @@ fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else - nightly_version=2023-04-19 + nightly_version=2023-08-25 fi diff --git a/ci/test-checks.sh b/ci/test-checks.sh index 15f891b1e2..0f037cb347 100755 --- a/ci/test-checks.sh +++ b/ci/test-checks.sh @@ -73,7 +73,7 @@ nightly_clippy_allows=(--allow=clippy::redundant_clone) _ scripts/cargo-for-all-lock-files.sh -- "+${rust_nightly}" clippy --workspace --all-targets --features dummy-for-ci-check -- \ --deny=warnings \ --deny=clippy::default_trait_access \ - --deny=clippy::integer_arithmetic \ + --deny=clippy::arithmetic_side_effects \ --deny=clippy::manual_let_else \ --deny=clippy::used_underscore_binding \ "${nightly_clippy_allows[@]}" @@ -87,7 +87,7 @@ _ scripts/cargo-for-all-lock-files.sh -- "+${rust_nightly}" clippy --workspace - _ scripts/cargo-for-all-lock-files.sh -- clippy --workspace --tests --bins --examples --features dummy-for-ci-check -- \ --deny=warnings \ --deny=clippy::default_trait_access \ - --deny=clippy::integer_arithmetic \ + --deny=clippy::arithmetic_side_effects \ --deny=clippy::manual_let_else \ --deny=clippy::used_underscore_binding diff --git a/cli-output/src/lib.rs b/cli-output/src/lib.rs index 3e85d825e1..5bd3c036f4 100644 --- a/cli-output/src/lib.rs +++ b/cli-output/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] mod cli_output; pub mod cli_version; pub mod display; diff --git a/cli/src/lib.rs b/cli/src/lib.rs index c271990b58..e55b14a854 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] macro_rules! ACCOUNT_STRING { () => { r#", one of: diff --git a/cli/tests/nonce.rs b/cli/tests/nonce.rs index 3fd93e1857..c5a2bcbb26 100644 --- a/cli/tests/nonce.rs +++ b/cli/tests/nonce.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_cli::{ check_balance, diff --git a/cli/tests/program.rs b/cli/tests/program.rs index 892c103255..ec28e46000 100644 --- a/cli/tests/program.rs +++ b/cli/tests/program.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { serde_json::Value, diff --git a/cli/tests/request_airdrop.rs b/cli/tests/request_airdrop.rs index daf0a6afd1..1004507aa0 100644 --- a/cli/tests/request_airdrop.rs +++ b/cli/tests/request_airdrop.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_cli::cli::{process_command, CliCommand, CliConfig}, solana_faucet::faucet::run_local_faucet, diff --git a/cli/tests/stake.rs b/cli/tests/stake.rs index 6b886c86b3..fe1396db6c 100644 --- a/cli/tests/stake.rs +++ b/cli/tests/stake.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![allow(clippy::redundant_closure)] use { assert_matches::assert_matches, diff --git a/cli/tests/transfer.rs b/cli/tests/transfer.rs index 03c731c723..7270a2c7e4 100644 --- a/cli/tests/transfer.rs +++ b/cli/tests/transfer.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![allow(clippy::redundant_closure)] use { solana_cli::{ diff --git a/cli/tests/vote.rs b/cli/tests/vote.rs index 1acd66d825..fb83d232a6 100644 --- a/cli/tests/vote.rs +++ b/cli/tests/vote.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_cli::{ check_balance, diff --git a/client/src/lib.rs b/client/src/lib.rs index 1148d9f82a..889b0c4d27 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod connection_cache; pub mod nonblocking; diff --git a/client/src/transaction_executor.rs b/client/src/transaction_executor.rs index 1dd9e860ca..c85aa21f8b 100644 --- a/client/src/transaction_executor.rs +++ b/client/src/transaction_executor.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { log::*, solana_measure::measure::Measure, diff --git a/connection-cache/src/lib.rs b/connection-cache/src/lib.rs index cc595ff574..80314369a6 100644 --- a/connection-cache/src/lib.rs +++ b/connection-cache/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod client_connection; pub mod connection_cache; diff --git a/core/benches/banking_stage.rs b/core/benches/banking_stage.rs index c8d9fbb84e..0b0e6876c3 100644 --- a/core/benches/banking_stage.rs +++ b/core/benches/banking_stage.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![feature(test)] extern crate test; diff --git a/core/benches/consumer.rs b/core/benches/consumer.rs index 78659757da..928758deb7 100644 --- a/core/benches/consumer.rs +++ b/core/benches/consumer.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![feature(test)] use { diff --git a/core/benches/shredder.rs b/core/benches/shredder.rs index 6216fdbd87..93093b1920 100644 --- a/core/benches/shredder.rs +++ b/core/benches/shredder.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![feature(test)] extern crate test; diff --git a/core/benches/sigverify_stage.rs b/core/benches/sigverify_stage.rs index afa355e981..70f33020dd 100644 --- a/core/benches/sigverify_stage.rs +++ b/core/benches/sigverify_stage.rs @@ -1,5 +1,5 @@ #![feature(test)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_core; extern crate test; diff --git a/core/src/lib.rs b/core/src/lib.rs index 2560e9b321..c1ee7dda1b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![recursion_limit = "2048"] //! The `solana` library implements the Solana high-performance blockchain architecture. //! It includes a full Rust implementation of the architecture (see diff --git a/core/tests/epoch_accounts_hash.rs b/core/tests/epoch_accounts_hash.rs index 5fdbc225ff..1f6eb70276 100755 --- a/core/tests/epoch_accounts_hash.rs +++ b/core/tests/epoch_accounts_hash.rs @@ -1,3 +1,6 @@ +// REMOVE once https://github.com/rust-lang/rust-clippy/issues/11153 is fixed +#![allow(clippy::items_after_test_module)] + use { crate::snapshot_utils::create_tmp_accounts_dir_for_tests, log::*, @@ -665,7 +668,7 @@ fn test_epoch_accounts_hash_and_warping() { // https://github.com/rust-lang/rust/pull/88582 // https://github.com/jhpratt/rust/blob/727a4fc7e3f836938dfeb4a2ab237cfca612222d/library/core/src/num/uint_macros.rs#L1811-L1837 const fn next_multiple_of(lhs: u64, rhs: u64) -> u64 { - #![allow(clippy::integer_arithmetic)] + #![allow(clippy::arithmetic_side_effects)] match lhs % rhs { 0 => lhs, r => lhs + (rhs - r), diff --git a/core/tests/fork-selection.rs b/core/tests/fork-selection.rs index 3f30ab3712..eead4942bd 100644 --- a/core/tests/fork-selection.rs +++ b/core/tests/fork-selection.rs @@ -71,7 +71,7 @@ //! ``` //! time: 4007, tip converged: 10, trunk id: 3830, trunk time: 3827, trunk converged 100, trunk height 348 //! ``` -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate rand; use { diff --git a/core/tests/ledger_cleanup.rs b/core/tests/ledger_cleanup.rs index 0d325bd31b..1a096c738b 100644 --- a/core/tests/ledger_cleanup.rs +++ b/core/tests/ledger_cleanup.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] // Long-running ledger_cleanup tests #[cfg(test)] diff --git a/core/tests/snapshots.rs b/core/tests/snapshots.rs index cf9a230085..b61e84a908 100644 --- a/core/tests/snapshots.rs +++ b/core/tests/snapshots.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::snapshot_utils::create_tmp_accounts_dir_for_tests, diff --git a/cost-model/src/lib.rs b/cost-model/src/lib.rs index 9afaf7b8a3..2dd7269e11 100644 --- a/cost-model/src/lib.rs +++ b/cost-model/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod block_cost_limits; pub mod cost_model; diff --git a/dos/src/lib.rs b/dos/src/lib.rs index 4bce837bd4..59df873f7c 100644 --- a/dos/src/lib.rs +++ b/dos/src/lib.rs @@ -1,2 +1,2 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod cli; diff --git a/dos/src/main.rs b/dos/src/main.rs index 93e2a871bd..40782bdcd5 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -38,7 +38,7 @@ //! solana-dos $COMMON --valid-blockhash --transaction-type account-creation //! ``` //! -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crossbeam_channel::{select, tick, unbounded, Receiver, Sender}, itertools::Itertools, diff --git a/download-utils/src/lib.rs b/download-utils/src/lib.rs index 7b4afc6162..c42166437c 100644 --- a/download-utils/src/lib.rs +++ b/download-utils/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { console::Emoji, indicatif::{ProgressBar, ProgressStyle}, diff --git a/entry/src/lib.rs b/entry/src/lib.rs index e081037f5b..1df354dfb6 100644 --- a/entry/src/lib.rs +++ b/entry/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod entry; pub mod poh; diff --git a/genesis/src/lib.rs b/genesis/src/lib.rs index 33a0e90e4c..5faf788d0f 100644 --- a/genesis/src/lib.rs +++ b/genesis/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod address_generator; pub mod genesis_accounts; pub mod stakes; diff --git a/genesis/src/main.rs b/genesis/src/main.rs index 5864ae62d9..038c85d4df 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -1,5 +1,5 @@ //! A command-line executable for generating the chain's genesis config. -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { base64::{prelude::BASE64_STANDARD, Engine}, diff --git a/gossip/src/lib.rs b/gossip/src/lib.rs index 8fd9d5f6dd..459d16babc 100644 --- a/gossip/src/lib.rs +++ b/gossip/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod cluster_info; pub mod cluster_info_metrics; diff --git a/gossip/tests/crds_gossip.rs b/gossip/tests/crds_gossip.rs index 33dcafd9a9..827da50390 100644 --- a/gossip/tests/crds_gossip.rs +++ b/gossip/tests/crds_gossip.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { bincode::serialized_size, log::*, diff --git a/gossip/tests/gossip.rs b/gossip/tests/gossip.rs index a1232b916b..9240c2b3ef 100644 --- a/gossip/tests/gossip.rs +++ b/gossip/tests/gossip.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[macro_use] extern crate log; diff --git a/install/src/lib.rs b/install/src/lib.rs index 32895b6e65..159317edd2 100644 --- a/install/src/lib.rs +++ b/install/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[macro_use] extern crate lazy_static; diff --git a/keygen/src/keygen.rs b/keygen/src/keygen.rs index d7c2e553c1..20e218d886 100644 --- a/keygen/src/keygen.rs +++ b/keygen/src/keygen.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { bip39::{Mnemonic, MnemonicType, Seed}, clap::{crate_description, crate_name, Arg, ArgMatches, Command}, diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index d6f061e591..49ed077fc3 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::{args::*, bigtable::*, ledger_path::*, ledger_utils::*, output::*, program::*}, chrono::{DateTime, Utc}, diff --git a/ledger/benches/blockstore.rs b/ledger/benches/blockstore.rs index 71cc243917..18f92bb60e 100644 --- a/ledger/benches/blockstore.rs +++ b/ledger/benches/blockstore.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![feature(test)] extern crate solana_ledger; extern crate test; diff --git a/ledger/benches/protobuf.rs b/ledger/benches/protobuf.rs index 240674ca01..8e462a84be 100644 --- a/ledger/benches/protobuf.rs +++ b/ledger/benches/protobuf.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![feature(test)] extern crate test; diff --git a/ledger/src/lib.rs b/ledger/src/lib.rs index 470d03cf22..a8f81be486 100644 --- a/ledger/src/lib.rs +++ b/ledger/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod bank_forks_utils; pub mod bigtable_delete; diff --git a/ledger/tests/shred.rs b/ledger/tests/shred.rs index a5adcebce5..78cdb28d0b 100644 --- a/ledger/tests/shred.rs +++ b/ledger/tests/shred.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_entry::entry::Entry, solana_ledger::shred::{ diff --git a/local-cluster/src/lib.rs b/local-cluster/src/lib.rs index 65c6578759..6a5b0c7032 100644 --- a/local-cluster/src/lib.rs +++ b/local-cluster/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod cluster; pub mod cluster_tests; pub mod integration_tests; diff --git a/local-cluster/tests/local_cluster.rs b/local-cluster/tests/local_cluster.rs index 086e6c8ce5..118332ed38 100644 --- a/local-cluster/tests/local_cluster.rs +++ b/local-cluster/tests/local_cluster.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { assert_matches::assert_matches, crossbeam_channel::{unbounded, Receiver}, diff --git a/log-analyzer/src/main.rs b/log-analyzer/src/main.rs index baac6597fe..fcedd7c0dc 100644 --- a/log-analyzer/src/main.rs +++ b/log-analyzer/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate byte_unit; use { diff --git a/measure/src/lib.rs b/measure/src/lib.rs index 8fd0b24444..a1c86feb89 100644 --- a/measure/src/lib.rs +++ b/measure/src/lib.rs @@ -1,3 +1,3 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod macros; pub mod measure; diff --git a/memory-management/src/aligned_memory.rs b/memory-management/src/aligned_memory.rs index a811054a03..689daaaed5 100644 --- a/memory-management/src/aligned_memory.rs +++ b/memory-management/src/aligned_memory.rs @@ -208,7 +208,7 @@ impl> From for AlignedMemory { #[cfg(test)] mod tests { - #![allow(clippy::integer_arithmetic)] + #![allow(clippy::arithmetic_side_effects)] use {super::*, std::io::Write}; fn do_test() { diff --git a/memory-management/src/lib.rs b/memory-management/src/lib.rs index 3a2503bb43..95caf247cd 100644 --- a/memory-management/src/lib.rs +++ b/memory-management/src/lib.rs @@ -1,4 +1,4 @@ -#![deny(clippy::integer_arithmetic)] +#![deny(clippy::arithmetic_side_effects)] pub mod aligned_memory; /// Returns true if `ptr` is aligned to `align`. diff --git a/merkle-tree/src/lib.rs b/merkle-tree/src/lib.rs index 5c890082a0..8d544444ab 100644 --- a/merkle-tree/src/lib.rs +++ b/merkle-tree/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[cfg(target_os = "solana")] #[macro_use] diff --git a/metrics/src/lib.rs b/metrics/src/lib.rs index 3fb6540da7..fab0d2b563 100644 --- a/metrics/src/lib.rs +++ b/metrics/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod counter; pub mod datapoint; pub mod metrics; diff --git a/net-shaper/src/main.rs b/net-shaper/src/main.rs index 6de02cd79b..f431cc5576 100644 --- a/net-shaper/src/main.rs +++ b/net-shaper/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { clap::{crate_description, crate_name, crate_version, Arg, ArgMatches, Command}, rand::{thread_rng, Rng}, diff --git a/net-utils/src/lib.rs b/net-utils/src/lib.rs index 3f3394144a..1ff48173de 100644 --- a/net-utils/src/lib.rs +++ b/net-utils/src/lib.rs @@ -1,5 +1,5 @@ //! The `net_utils` module assists with networking -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crossbeam_channel::unbounded, log::*, diff --git a/perf/benches/dedup.rs b/perf/benches/dedup.rs index 8570692bcf..8d2198d319 100644 --- a/perf/benches/dedup.rs +++ b/perf/benches/dedup.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![feature(test)] extern crate test; diff --git a/perf/benches/shrink.rs b/perf/benches/shrink.rs index 08f1915789..4459f5f9a6 100644 --- a/perf/benches/shrink.rs +++ b/perf/benches/shrink.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![feature(test)] extern crate test; diff --git a/perf/src/deduper.rs b/perf/src/deduper.rs index aafcece1de..063ff0492d 100644 --- a/perf/src/deduper.rs +++ b/perf/src/deduper.rs @@ -64,7 +64,7 @@ impl Deduper { // Returns true if the data is duplicate. #[must_use] - #[allow(clippy::integer_arithmetic)] + #[allow(clippy::arithmetic_side_effects)] pub fn dedup(&self, data: &T) -> bool { let mut out = true; let hashers = self.state.iter().map(RandomState::build_hasher); @@ -114,7 +114,7 @@ pub fn dedup_packets_and_count_discards( } #[cfg(test)] -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] mod tests { use { super::*, diff --git a/perf/src/sigverify.rs b/perf/src/sigverify.rs index ccccd160ad..6078961d42 100644 --- a/perf/src/sigverify.rs +++ b/perf/src/sigverify.rs @@ -676,7 +676,7 @@ pub fn ed25519_verify( } #[cfg(test)] -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] mod tests { use { super::*, diff --git a/poh-bench/src/main.rs b/poh-bench/src/main.rs index c07c4b00c6..d835bac05a 100644 --- a/poh-bench/src/main.rs +++ b/poh-bench/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] use solana_entry::entry::{self, create_ticks, init_poh, EntrySlice, VerifyRecyclers}; #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] diff --git a/poh/src/lib.rs b/poh/src/lib.rs index 017d9889c0..80a02148f3 100644 --- a/poh/src/lib.rs +++ b/poh/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod leader_bank_notifier; pub mod poh_recorder; pub mod poh_service; diff --git a/program-runtime/src/lib.rs b/program-runtime/src/lib.rs index 24aae9ca98..d43d9a5b35 100644 --- a/program-runtime/src/lib.rs +++ b/program-runtime/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![deny(clippy::integer_arithmetic)] +#![deny(clippy::arithmetic_side_effects)] #![deny(clippy::indexing_slicing)] #![recursion_limit = "2048"] diff --git a/program-test/src/lib.rs b/program-test/src/lib.rs index a4a5207a9d..4cc8fc9ba2 100644 --- a/program-test/src/lib.rs +++ b/program-test/src/lib.rs @@ -1,5 +1,5 @@ //! The solana-program-test provides a BanksClient-based test framework SBF programs -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] // Export tokio for test clients pub use tokio; diff --git a/program-test/tests/warp.rs b/program-test/tests/warp.rs index 05e60deef3..94f497a98f 100644 --- a/program-test/tests/warp.rs +++ b/program-test/tests/warp.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { bincode::deserialize, log::debug, diff --git a/programs/bpf_loader/src/lib.rs b/programs/bpf_loader/src/lib.rs index 45430a3693..69151d41e2 100644 --- a/programs/bpf_loader/src/lib.rs +++ b/programs/bpf_loader/src/lib.rs @@ -1,4 +1,4 @@ -#![deny(clippy::integer_arithmetic)] +#![deny(clippy::arithmetic_side_effects)] #![deny(clippy::indexing_slicing)] pub mod serialization; diff --git a/programs/bpf_loader/src/serialization.rs b/programs/bpf_loader/src/serialization.rs index 1650b845a9..628b52d5dd 100644 --- a/programs/bpf_loader/src/serialization.rs +++ b/programs/bpf_loader/src/serialization.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { byteorder::{ByteOrder, LittleEndian}, diff --git a/programs/bpf_loader/src/syscalls/cpi.rs b/programs/bpf_loader/src/syscalls/cpi.rs index 568be8b6c0..0240ca65b0 100644 --- a/programs/bpf_loader/src/syscalls/cpi.rs +++ b/programs/bpf_loader/src/syscalls/cpi.rs @@ -1632,7 +1632,7 @@ fn account_realloc_region<'a>( } #[allow(clippy::indexing_slicing)] -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] #[cfg(test)] mod tests { use { diff --git a/programs/bpf_loader/src/syscalls/mod.rs b/programs/bpf_loader/src/syscalls/mod.rs index 5f3a420828..2a52bd9aad 100644 --- a/programs/bpf_loader/src/syscalls/mod.rs +++ b/programs/bpf_loader/src/syscalls/mod.rs @@ -367,11 +367,13 @@ fn translate_type_inner<'a, T>( check_aligned: bool, ) -> Result<&'a mut T, Error> { let host_addr = translate(memory_mapping, access_type, vm_addr, size_of::() as u64)?; - - if check_aligned && !address_is_aligned::(host_addr) { - return Err(SyscallError::UnalignedPointer.into()); + if !check_aligned { + Ok(unsafe { std::mem::transmute::(host_addr) }) + } else if !address_is_aligned::(host_addr) { + Err(SyscallError::UnalignedPointer.into()) + } else { + Ok(unsafe { &mut *(host_addr as *mut T) }) } - Ok(unsafe { &mut *(host_addr as *mut T) }) } fn translate_type_mut<'a, T>( memory_mapping: &MemoryMapping, @@ -1879,7 +1881,7 @@ declare_syscall!( ); #[cfg(test)] -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] #[allow(clippy::indexing_slicing)] mod tests { #[allow(deprecated)] diff --git a/programs/config/src/lib.rs b/programs/config/src/lib.rs index d7ec42a0e6..c165b14477 100644 --- a/programs/config/src/lib.rs +++ b/programs/config/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod config_instruction; pub mod config_processor; pub mod date_instruction; diff --git a/programs/sbf/benches/bpf_loader.rs b/programs/sbf/benches/bpf_loader.rs index 566dbbfbc2..f994177608 100644 --- a/programs/sbf/benches/bpf_loader.rs +++ b/programs/sbf/benches/bpf_loader.rs @@ -1,7 +1,7 @@ #![feature(test)] #![cfg(feature = "sbf_c")] #![allow(clippy::uninlined_format_args)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_rbpf::memory_region::MemoryState, diff --git a/programs/sbf/rust/128bit/src/lib.rs b/programs/sbf/rust/128bit/src/lib.rs index de66b35034..985e41bbe4 100644 --- a/programs/sbf/rust/128bit/src/lib.rs +++ b/programs/sbf/rust/128bit/src/lib.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF program tests loop iteration -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::{custom_heap_default, custom_panic_default, entrypoint::SUCCESS}; diff --git a/programs/sbf/rust/128bit_dep/src/lib.rs b/programs/sbf/rust/128bit_dep/src/lib.rs index 7ed9f48a0f..c78c13a357 100644 --- a/programs/sbf/rust/128bit_dep/src/lib.rs +++ b/programs/sbf/rust/128bit_dep/src/lib.rs @@ -1,6 +1,6 @@ //! Solana Rust-based SBF program utility functions and types -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; diff --git a/programs/sbf/rust/alloc/src/lib.rs b/programs/sbf/rust/alloc/src/lib.rs index 356f9a82f7..2ee3e72f8b 100644 --- a/programs/sbf/rust/alloc/src/lib.rs +++ b/programs/sbf/rust/alloc/src/lib.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF program that test dynamic memory allocation -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[macro_use] extern crate alloc; diff --git a/programs/sbf/rust/custom_heap/src/lib.rs b/programs/sbf/rust/custom_heap/src/lib.rs index 9bc4699d9e..ce96f8db1a 100644 --- a/programs/sbf/rust/custom_heap/src/lib.rs +++ b/programs/sbf/rust/custom_heap/src/lib.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF that tests out using a custom heap -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_program::{ diff --git a/programs/sbf/rust/deprecated_loader/src/lib.rs b/programs/sbf/rust/deprecated_loader/src/lib.rs index ddd81fca87..772e0c0f59 100644 --- a/programs/sbf/rust/deprecated_loader/src/lib.rs +++ b/programs/sbf/rust/deprecated_loader/src/lib.rs @@ -1,7 +1,7 @@ //! Example Rust-based SBF program that supports the deprecated loader #![allow(unreachable_code)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::{ diff --git a/programs/sbf/rust/dup_accounts/src/lib.rs b/programs/sbf/rust/dup_accounts/src/lib.rs index 4c756050b7..2dc96fab5a 100644 --- a/programs/sbf/rust/dup_accounts/src/lib.rs +++ b/programs/sbf/rust/dup_accounts/src/lib.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF program that tests duplicate accounts passed via accounts -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::{ diff --git a/programs/sbf/rust/external_spend/src/lib.rs b/programs/sbf/rust/external_spend/src/lib.rs index d2d4ad7d72..3d94ef2e78 100644 --- a/programs/sbf/rust/external_spend/src/lib.rs +++ b/programs/sbf/rust/external_spend/src/lib.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF program that moves a lamport from one account to another -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; diff --git a/programs/sbf/rust/invoked/src/processor.rs b/programs/sbf/rust/invoked/src/processor.rs index 42a427c74d..73bf25cac7 100644 --- a/programs/sbf/rust/invoked/src/processor.rs +++ b/programs/sbf/rust/invoked/src/processor.rs @@ -1,7 +1,7 @@ //! Example Rust-based SBF program that issues a cross-program-invocation #![cfg(feature = "program")] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::instructions::*, diff --git a/programs/sbf/rust/iter/src/lib.rs b/programs/sbf/rust/iter/src/lib.rs index 6fa13ac752..2128765e13 100644 --- a/programs/sbf/rust/iter/src/lib.rs +++ b/programs/sbf/rust/iter/src/lib.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF program tests loop iteration -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::{ diff --git a/programs/sbf/rust/many_args/src/helper.rs b/programs/sbf/rust/many_args/src/helper.rs index f5196ab474..72c89fc060 100644 --- a/programs/sbf/rust/many_args/src/helper.rs +++ b/programs/sbf/rust/many_args/src/helper.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF program tests loop iteration -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::log::*; diff --git a/programs/sbf/rust/many_args_dep/src/lib.rs b/programs/sbf/rust/many_args_dep/src/lib.rs index 6030303477..263b0e1ce0 100644 --- a/programs/sbf/rust/many_args_dep/src/lib.rs +++ b/programs/sbf/rust/many_args_dep/src/lib.rs @@ -1,6 +1,6 @@ //! Solana Rust-based SBF program utility functions and types -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::{log::sol_log_64, msg}; diff --git a/programs/sbf/rust/param_passing_dep/src/lib.rs b/programs/sbf/rust/param_passing_dep/src/lib.rs index 3aa9fa8a41..2a95ce8600 100644 --- a/programs/sbf/rust/param_passing_dep/src/lib.rs +++ b/programs/sbf/rust/param_passing_dep/src/lib.rs @@ -1,6 +1,6 @@ //! Example Rust-based SBF program tests loop iteration -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; diff --git a/programs/sbf/rust/sanity/src/lib.rs b/programs/sbf/rust/sanity/src/lib.rs index c3545c48b0..0c820eaa95 100644 --- a/programs/sbf/rust/sanity/src/lib.rs +++ b/programs/sbf/rust/sanity/src/lib.rs @@ -1,7 +1,7 @@ //! Example Rust-based SBF sanity program that prints out the parameters passed to it #![allow(unreachable_code)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate solana_program; use solana_program::{ diff --git a/programs/sbf/rust/sibling_inner_instruction/src/lib.rs b/programs/sbf/rust/sibling_inner_instruction/src/lib.rs index 56df749d60..bac79f67ee 100644 --- a/programs/sbf/rust/sibling_inner_instruction/src/lib.rs +++ b/programs/sbf/rust/sibling_inner_instruction/src/lib.rs @@ -1,7 +1,7 @@ //! Example Rust-based SBF program that queries sibling instructions #![cfg(feature = "program")] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use solana_program::{ account_info::AccountInfo, diff --git a/programs/sbf/rust/simulation/src/lib.rs b/programs/sbf/rust/simulation/src/lib.rs index 212619c220..843a842ec4 100644 --- a/programs/sbf/rust/simulation/src/lib.rs +++ b/programs/sbf/rust/simulation/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_program::{ diff --git a/programs/sbf/rust/spoof1_system/src/lib.rs b/programs/sbf/rust/spoof1_system/src/lib.rs index 37ec33f275..fbc65dfd80 100644 --- a/programs/sbf/rust/spoof1_system/src/lib.rs +++ b/programs/sbf/rust/spoof1_system/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; diff --git a/programs/stake/src/lib.rs b/programs/stake/src/lib.rs index 0f0d208532..b6d2ff4784 100644 --- a/programs/stake/src/lib.rs +++ b/programs/stake/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[deprecated( since = "1.8.0", note = "Please use `solana_sdk::stake::program::id` or `solana_program::stake::program::id` instead" diff --git a/programs/system/src/lib.rs b/programs/system/src/lib.rs index c1bfc54804..140127c213 100644 --- a/programs/system/src/lib.rs +++ b/programs/system/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod system_instruction; pub mod system_processor; diff --git a/pubsub-client/src/lib.rs b/pubsub-client/src/lib.rs index 72beff330f..d572ee5339 100644 --- a/pubsub-client/src/lib.rs +++ b/pubsub-client/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod nonblocking; pub mod pubsub_client; diff --git a/quic-client/src/lib.rs b/quic-client/src/lib.rs index 5560f018e5..0357969d82 100644 --- a/quic-client/src/lib.rs +++ b/quic-client/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod nonblocking; pub mod quic_client; diff --git a/remote-wallet/src/lib.rs b/remote-wallet/src/lib.rs index 125f126685..2400850734 100644 --- a/remote-wallet/src/lib.rs +++ b/remote-wallet/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #![allow(dead_code)] pub mod ledger; pub mod ledger_error; diff --git a/rpc-client-api/src/lib.rs b/rpc-client-api/src/lib.rs index 9be15cbab4..6386a433f7 100644 --- a/rpc-client-api/src/lib.rs +++ b/rpc-client-api/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod client_error; pub mod config; diff --git a/rpc-client/src/lib.rs b/rpc-client/src/lib.rs index 43c15d8765..fddf3e0aab 100644 --- a/rpc-client/src/lib.rs +++ b/rpc-client/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod http_sender; pub mod mock_sender; diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index d021155e89..2a5065d95d 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] mod cluster_tpu_info; pub mod max_slots; pub mod optimistically_confirmed_bank_tracker; diff --git a/runtime/benches/accounts.rs b/runtime/benches/accounts.rs index 8849f57bbc..fcd784a21e 100644 --- a/runtime/benches/accounts.rs +++ b/runtime/benches/accounts.rs @@ -1,5 +1,5 @@ #![feature(test)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate test; diff --git a/runtime/benches/bank.rs b/runtime/benches/bank.rs index 0460617c53..fc8dfbd4a4 100644 --- a/runtime/benches/bank.rs +++ b/runtime/benches/bank.rs @@ -1,5 +1,5 @@ #![feature(test)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate test; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 7978048c85..fb22c1f96c 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[macro_use] extern crate lazy_static; diff --git a/runtime/tests/stake.rs b/runtime/tests/stake.rs index b0d5e13546..c260fead02 100755 --- a/runtime/tests/stake.rs +++ b/runtime/tests/stake.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { solana_accounts_db::epoch_accounts_hash::EpochAccountsHash, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f2415f8315..743f7cd993 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.69.0" +channel = "1.72.0" diff --git a/sdk/benches/accounts.rs b/sdk/benches/accounts.rs index 2caf0e421e..1206f67860 100644 --- a/sdk/benches/accounts.rs +++ b/sdk/benches/accounts.rs @@ -1,5 +1,5 @@ #![feature(test)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use solana_sdk::{entrypoint::MAX_PERMITTED_DATA_INCREASE, pubkey::Pubkey}; diff --git a/sdk/gen-headers/src/main.rs b/sdk/gen-headers/src/main.rs index d40143bdc7..a0a90a4355 100644 --- a/sdk/gen-headers/src/main.rs +++ b/sdk/gen-headers/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { log::info, diff --git a/sdk/program/src/account_info.rs b/sdk/program/src/account_info.rs index 372370d0e1..3db3e9839b 100644 --- a/sdk/program/src/account_info.rs +++ b/sdk/program/src/account_info.rs @@ -182,6 +182,7 @@ impl<'a> AccountInfo<'a> { Ok(()) } + #[rustversion::attr(since(1.72), allow(invalid_reference_casting))] pub fn assign(&self, new_owner: &Pubkey) { // Set the non-mut owner field unsafe { diff --git a/sdk/program/src/borsh0_10.rs b/sdk/program/src/borsh0_10.rs index d4830fa2bf..f29640885e 100644 --- a/sdk/program/src/borsh0_10.rs +++ b/sdk/program/src/borsh0_10.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] //! Utilities for the [borsh] serialization format, version 0.10. //! //! [borsh]: https://borsh.io/ diff --git a/sdk/program/src/borsh0_9.rs b/sdk/program/src/borsh0_9.rs index 83f62bc003..dd9e401db1 100644 --- a/sdk/program/src/borsh0_9.rs +++ b/sdk/program/src/borsh0_9.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] //! Utilities for the [borsh] serialization format, version 0.9. //! //! This file is provided for backwards compatibility with types that still use diff --git a/sdk/program/src/entrypoint.rs b/sdk/program/src/entrypoint.rs index 3b70a8b07f..a2fba66da2 100644 --- a/sdk/program/src/entrypoint.rs +++ b/sdk/program/src/entrypoint.rs @@ -234,7 +234,7 @@ pub struct BumpAllocator { /// Integer arithmetic in this global allocator implementation is safe when /// operating on the prescribed `HEAP_START_ADDRESS` and `HEAP_LENGTH`. Any /// other use may overflow and is thus unsupported and at one's own risk. -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] unsafe impl std::alloc::GlobalAlloc for BumpAllocator { #[inline] unsafe fn alloc(&self, layout: Layout) -> *mut u8 { @@ -272,7 +272,7 @@ pub const BPF_ALIGN_OF_U128: usize = 8; /// done at one's own risk. /// /// # Safety -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] #[allow(clippy::type_complexity)] pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec>, &'a [u8]) { let mut offset: usize = 0; diff --git a/sdk/program/src/entrypoint_deprecated.rs b/sdk/program/src/entrypoint_deprecated.rs index 05df3ccd78..7eedbe6596 100644 --- a/sdk/program/src/entrypoint_deprecated.rs +++ b/sdk/program/src/entrypoint_deprecated.rs @@ -7,7 +7,7 @@ //! //! [`bpf_loader_deprecated`]: crate::bpf_loader_deprecated -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] extern crate alloc; use { diff --git a/sdk/program/src/fee_calculator.rs b/sdk/program/src/fee_calculator.rs index 2628466f71..ef29ec2e2b 100644 --- a/sdk/program/src/fee_calculator.rs +++ b/sdk/program/src/fee_calculator.rs @@ -1,6 +1,6 @@ //! Calculation of transaction fees. -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::{clock::DEFAULT_MS_PER_SLOT, ed25519_program, message::Message, secp256k1_program}, log::*, diff --git a/sdk/program/src/instruction.rs b/sdk/program/src/instruction.rs index 404fa54ed3..0aef000866 100644 --- a/sdk/program/src/instruction.rs +++ b/sdk/program/src/instruction.rs @@ -11,7 +11,7 @@ //! [`AccountMeta`] values. The runtime uses this information to efficiently //! schedule execution of transactions. -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::{pubkey::Pubkey, sanitize::Sanitize, short_vec, wasm_bindgen}, @@ -744,42 +744,3 @@ pub fn get_stack_height() -> usize { crate::program_stubs::sol_get_stack_height() as usize } } - -#[test] -fn test_account_meta_layout() { - #[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)] - struct AccountMetaRust { - pub pubkey: Pubkey, - pub is_signer: bool, - pub is_writable: bool, - } - - let account_meta_rust = AccountMetaRust::default(); - let base_rust_addr = &account_meta_rust as *const _ as u64; - let pubkey_rust_addr = &account_meta_rust.pubkey as *const _ as u64; - let is_signer_rust_addr = &account_meta_rust.is_signer as *const _ as u64; - let is_writable_rust_addr = &account_meta_rust.is_writable as *const _ as u64; - - let account_meta_c = AccountMeta::default(); - let base_c_addr = &account_meta_c as *const _ as u64; - let pubkey_c_addr = &account_meta_c.pubkey as *const _ as u64; - let is_signer_c_addr = &account_meta_c.is_signer as *const _ as u64; - let is_writable_c_addr = &account_meta_c.is_writable as *const _ as u64; - - assert_eq!( - std::mem::size_of::(), - std::mem::size_of::() - ); - assert_eq!( - pubkey_rust_addr - base_rust_addr, - pubkey_c_addr - base_c_addr - ); - assert_eq!( - is_signer_rust_addr - base_rust_addr, - is_signer_c_addr - base_c_addr - ); - assert_eq!( - is_writable_rust_addr - base_rust_addr, - is_writable_c_addr - base_c_addr - ); -} diff --git a/sdk/program/src/lib.rs b/sdk/program/src/lib.rs index 21312fb7f3..76d86e1bc8 100644 --- a/sdk/program/src/lib.rs +++ b/sdk/program/src/lib.rs @@ -743,7 +743,7 @@ macro_rules! unchecked_div_by_const { // ugly error messages! // https://users.rust-lang.org/t/unexpected-behavior-of-compile-time-integer-div-by-zero-check-in-declarative-macro/56718 let _ = [(); ($den as usize) - 1]; - #[allow(clippy::integer_arithmetic)] + #[allow(clippy::arithmetic_side_effects)] let quotient = $num / $den; quotient }}; diff --git a/sdk/program/src/message/legacy.rs b/sdk/program/src/message/legacy.rs index e078c1d0f0..e81c7c485f 100644 --- a/sdk/program/src/message/legacy.rs +++ b/sdk/program/src/message/legacy.rs @@ -9,7 +9,7 @@ //! [`v0`]: crate::message::v0 //! [future message format]: https://docs.solana.com/proposals/versioned-transactions -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::{ @@ -597,7 +597,7 @@ impl Message { // `bench_has_duplicates` in benches/message_processor.rs shows that this implementation is // ~50 times faster than using HashSet for very short slices. for i in 1..self.account_keys.len() { - #[allow(clippy::integer_arithmetic)] + #[allow(clippy::arithmetic_side_effects)] if self.account_keys[i..].contains(&self.account_keys[i - 1]) { return true; } diff --git a/sdk/program/src/native_token.rs b/sdk/program/src/native_token.rs index c3731582ab..ac494bc831 100644 --- a/sdk/program/src/native_token.rs +++ b/sdk/program/src/native_token.rs @@ -1,6 +1,6 @@ //! Definitions for the native SOL token and its fractional lamports. -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] /// There are 10^9 lamports in one SOL pub const LAMPORTS_PER_SOL: u64 = 1_000_000_000; diff --git a/sdk/program/src/program.rs b/sdk/program/src/program.rs index a41f7b5267..ac7ffb05f3 100644 --- a/sdk/program/src/program.rs +++ b/sdk/program/src/program.rs @@ -392,7 +392,7 @@ pub fn get_return_data() -> Option<(Pubkey, Vec)> { /// Do sanity checks of type layout. #[doc(hidden)] -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] pub fn check_type_assumptions() { extern crate memoffset; use { diff --git a/sdk/program/src/program_error.rs b/sdk/program/src/program_error.rs index 8644b6ad78..a0d217a96b 100644 --- a/sdk/program/src/program_error.rs +++ b/sdk/program/src/program_error.rs @@ -1,6 +1,6 @@ //! The [`ProgramError`] type and related definitions. -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::{decode_error::DecodeError, instruction::InstructionError, msg, pubkey::PubkeyError}, borsh::maybestd::io::Error as BorshIoError, diff --git a/sdk/program/src/program_stubs.rs b/sdk/program/src/program_stubs.rs index fb6861b74c..24f4dc57d3 100644 --- a/sdk/program/src/program_stubs.rs +++ b/sdk/program/src/program_stubs.rs @@ -22,7 +22,7 @@ pub fn set_syscall_stubs(syscall_stubs: Box) -> Box::BITS { let Some(byte) = seq.next_element::()? else { - return Err(A::Error::custom("Invalid Sequence")); - }; + return Err(A::Error::custom("Invalid Sequence")); + }; out |= ((byte & 0x7F) as Self) << shift; if byte & 0x80 == 0 { // Last byte should not have been truncated when it was diff --git a/sdk/program/src/serialize_utils.rs b/sdk/program/src/serialize_utils.rs index a2b61f75d0..d57095ce7a 100644 --- a/sdk/program/src/serialize_utils.rs +++ b/sdk/program/src/serialize_utils.rs @@ -1,6 +1,6 @@ //! Helpers for reading and writing bytes. -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use crate::{pubkey::Pubkey, sanitize::SanitizeError}; pub fn append_u16(buf: &mut Vec, data: u16) { diff --git a/sdk/program/src/short_vec.rs b/sdk/program/src/short_vec.rs index cbf3721914..b6674ee57e 100644 --- a/sdk/program/src/short_vec.rs +++ b/sdk/program/src/short_vec.rs @@ -1,6 +1,6 @@ //! Compact serde-encoding of vectors with small length. -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { serde::{ de::{self, Deserializer, SeqAccess, Visitor}, diff --git a/sdk/program/src/slot_history.rs b/sdk/program/src/slot_history.rs index 7e62b0798b..725916da26 100644 --- a/sdk/program/src/slot_history.rs +++ b/sdk/program/src/slot_history.rs @@ -6,7 +6,7 @@ //! //! [`sysvar::slot_history`]: crate::sysvar::slot_history -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub use crate::clock::Slot; use bv::{BitVec, BitsMut}; diff --git a/sdk/program/src/stake/state.rs b/sdk/program/src/stake/state.rs index b8f2e3be01..969e5f2cef 100644 --- a/sdk/program/src/stake/state.rs +++ b/sdk/program/src/stake/state.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] // Remove the following `allow` when `StakeState` is removed, required to avoid // warnings from uses of deprecated types during trait derivations. #![allow(deprecated)] diff --git a/sdk/program/src/sysvar/instructions.rs b/sdk/program/src/sysvar/instructions.rs index ede54465cc..ce4283d0c3 100644 --- a/sdk/program/src/sysvar/instructions.rs +++ b/sdk/program/src/sysvar/instructions.rs @@ -27,7 +27,7 @@ //! //! [`secp256k1_instruction`]: https://docs.rs/solana-sdk/latest/solana_sdk/secp256k1_instruction/index.html -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use crate::{ account_info::AccountInfo, diff --git a/sdk/program/src/sysvar/recent_blockhashes.rs b/sdk/program/src/sysvar/recent_blockhashes.rs index a9b02946a5..91be1b8276 100644 --- a/sdk/program/src/sysvar/recent_blockhashes.rs +++ b/sdk/program/src/sysvar/recent_blockhashes.rs @@ -17,7 +17,7 @@ //! [sdoc]: https://docs.solana.com/developing/runtime-facilities/sysvars#recentblockhashes #![allow(deprecated)] -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::{ declare_deprecated_sysvar_id, fee_calculator::FeeCalculator, hash::Hash, sysvar::Sysvar, diff --git a/sdk/program/src/vote/state/vote_state_0_23_5.rs b/sdk/program/src/vote/state/vote_state_0_23_5.rs index 7ba4e361ee..ae3b9207fe 100644 --- a/sdk/program/src/vote/state/vote_state_0_23_5.rs +++ b/sdk/program/src/vote/state/vote_state_0_23_5.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use super::*; const MAX_ITEMS: usize = 32; diff --git a/sdk/src/offchain_message.rs b/sdk/src/offchain_message.rs index d6888ca198..2170aedb2c 100644 --- a/sdk/src/offchain_message.rs +++ b/sdk/src/offchain_message.rs @@ -42,7 +42,7 @@ pub enum MessageFormat { ExtendedUtf8, } -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] pub mod v0 { use { super::{is_printable_ascii, is_utf8, MessageFormat, OffchainMessage as Base}, diff --git a/sdk/src/shred_version.rs b/sdk/src/shred_version.rs index 6017202c9d..a113a2af13 100644 --- a/sdk/src/shred_version.rs +++ b/sdk/src/shred_version.rs @@ -20,7 +20,7 @@ pub fn version_from_hash(hash: &Hash) -> u16 { }); // convert accum into a u16 // Because accum[0] is a u8, 8bit left shift of the u16 can never overflow - #[allow(clippy::integer_arithmetic)] + #[allow(clippy::arithmetic_side_effects)] let version = ((accum[0] as u16) << 8) | accum[1] as u16; // ensure version is never zero, to avoid looking like an uninitialized version diff --git a/sdk/src/transaction/sanitized.rs b/sdk/src/transaction/sanitized.rs index f73c66a9ed..117ae0a8e0 100644 --- a/sdk/src/transaction/sanitized.rs +++ b/sdk/src/transaction/sanitized.rs @@ -298,7 +298,7 @@ impl SanitizedTransaction { } #[cfg(test)] -#[allow(clippy::integer_arithmetic)] +#[allow(clippy::arithmetic_side_effects)] mod tests { use { super::*, diff --git a/send-transaction-service/src/lib.rs b/send-transaction-service/src/lib.rs index 48820025bb..fe2bc0c7af 100644 --- a/send-transaction-service/src/lib.rs +++ b/send-transaction-service/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod send_transaction_service; pub mod tpu_info; diff --git a/stake-accounts/src/main.rs b/stake-accounts/src/main.rs index d9f9ebc238..c931e7423b 100644 --- a/stake-accounts/src/main.rs +++ b/stake-accounts/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] mod arg_parser; mod args; mod stake_accounts; diff --git a/storage-bigtable/src/lib.rs b/storage-bigtable/src/lib.rs index aa891fe0cd..0b8ed4d3a5 100644 --- a/storage-bigtable/src/lib.rs +++ b/storage-bigtable/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { crate::bigtable::RowKey, diff --git a/streamer/src/lib.rs b/streamer/src/lib.rs index 2dfee737cd..225515646e 100644 --- a/streamer/src/lib.rs +++ b/streamer/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod nonblocking; pub mod packet; pub mod quic; diff --git a/test-validator/src/lib.rs b/test-validator/src/lib.rs index f657aaee1c..5737f71a6a 100644 --- a/test-validator/src/lib.rs +++ b/test-validator/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { base64::{prelude::BASE64_STANDARD, Engine}, crossbeam_channel::Receiver, diff --git a/thin-client/src/lib.rs b/thin-client/src/lib.rs index afb3489f2a..b685f45ce3 100644 --- a/thin-client/src/lib.rs +++ b/thin-client/src/lib.rs @@ -1,3 +1,3 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod thin_client; diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index 8df0d4f482..0198312abe 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod arg_parser; pub mod args; pub mod commands; diff --git a/tpu-client/src/lib.rs b/tpu-client/src/lib.rs index 199a09091e..54adaec935 100644 --- a/tpu-client/src/lib.rs +++ b/tpu-client/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod nonblocking; pub mod tpu_client; diff --git a/transaction-dos/src/main.rs b/transaction-dos/src/main.rs index 0add74885b..5d69e9e291 100644 --- a/transaction-dos/src/main.rs +++ b/transaction-dos/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { clap::{crate_description, crate_name, value_t, values_t_or_exit, App, Arg}, diff --git a/transaction-status/src/lib.rs b/transaction-status/src/lib.rs index bb1ddd42d0..84654a564c 100644 --- a/transaction-status/src/lib.rs +++ b/transaction-status/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub use {crate::extract_memos::extract_and_fmt_memos, solana_sdk::reward_type::RewardType}; use { diff --git a/turbine/src/lib.rs b/turbine/src/lib.rs index d73713549d..0f7d538542 100644 --- a/turbine/src/lib.rs +++ b/turbine/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod broadcast_stage; pub mod cluster_nodes; diff --git a/udp-client/src/lib.rs b/udp-client/src/lib.rs index 75ba9139d3..c4ed99b3b7 100644 --- a/udp-client/src/lib.rs +++ b/udp-client/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub mod nonblocking; pub mod udp_client; diff --git a/validator/src/lib.rs b/validator/src/lib.rs index 4bf5a381d1..4e7ed43ec7 100644 --- a/validator/src/lib.rs +++ b/validator/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] pub use solana_test_validator as test_validator; use { console::style, diff --git a/validator/src/main.rs b/validator/src/main.rs index f27d4fcc65..91a31d6d64 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] #[cfg(not(target_env = "msvc"))] use jemallocator::Jemalloc; use { diff --git a/watchtower/src/main.rs b/watchtower/src/main.rs index 8801853d0e..f42acdaada 100644 --- a/watchtower/src/main.rs +++ b/watchtower/src/main.rs @@ -1,5 +1,5 @@ //! A command-line executable for monitoring the health of a cluster -#![allow(clippy::integer_arithmetic)] +#![allow(clippy::arithmetic_side_effects)] use { clap::{crate_description, crate_name, value_t, value_t_or_exit, App, Arg}, diff --git a/zk-token-sdk/src/lib.rs b/zk-token-sdk/src/lib.rs index 9f4e9b7a5d..f66850e382 100644 --- a/zk-token-sdk/src/lib.rs +++ b/zk-token-sdk/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::integer_arithmetic, clippy::op_ref)] +#![allow(clippy::arithmetic_side_effects, clippy::op_ref)] // The warning `clippy::op_ref` is disabled to allow efficient operator arithmetic of structs that // implement the `Copy` trait.