chore: prepare for rustc version bump to v1.95.0#10637
Conversation
There was a problem hiding this comment.
This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):
-
Update
unreleased_changelog.md(if there are behavior changes, even if they are
non-breaking). -
Are there BREAKING changes?
-
Is a data migration needed?
-
Security review?
How to Satisfy This Automatic Review
-
Go to the bottom of the pull request page.
-
Look for where it says this bot is requesting changes.
-
Click the three dots to the right.
-
Select "Dismiss review".
-
In the text entry box, respond to each of the numbered items in the previous
section, declare one of the following:
-
Done.
-
$REASON_WHY_NO_NEED. E.g. for
unreleased_changelog.md, "No
canister behavior changes.", or for item 2, "Existing APIs
behave as before.".
Brief Guide to "Externally Visible" Changes
"Externally visible behavior change" is very often due to some NEW canister API.
Changes to EXISTING APIs are more likely to be "breaking".
If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.
If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.
Reference(s)
For a more comprehensive checklist, see here.
GOVERNANCE_CHECKLIST_REMINDER_DEDUP
No canister behavior changes.
|
✅ No security or compliance issues detected. Reviewed everything up to 0d8bf5f. Security Overview
Detected Code Changes
|
|
✅ No security or compliance issues detected. Reviewed everything up to 0d8bf5f. Security Overview
Detected Code Changes
|
|
✅ No security or compliance issues detected. Reviewed everything up to 0d8bf5f. Security Overview
Detected Code Changes
|
|
✅ No security or compliance issues detected. Reviewed everything up to 0d8bf5f. Security Overview
Detected Code Changes
|
|
✅ No security or compliance issues detected. Reviewed everything up to 0d8bf5f. Security Overview
Detected Code Changes
|
There was a problem hiding this comment.
Pull request overview
This PR prepares the codebase for a Rust toolchain bump to rustc v1.95.0 by applying mechanical Rust changes (iterator ergonomics, sorting helpers, safer division) and adding narrowly scoped Clippy allowances where new lints would otherwise block the build.
Changes:
- Replace manual
if denom != 0 { num / denom }patterns withchecked_div(...).map_or/unwrap_or(...)to satisfy newer lints and avoid div-by-zero. - Simplify iterator usage (
.into_iter()elision,.values()/.into_values(),.keys(),.extend(...)) to match newer trait/iterator expectations. - Replace comparator closures with
sort_by_key(andReverse) and add targeted#[allow(clippy::...)]where needed.
Reviewed changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rs/xnet/payload_builder/src/proximity.rs | Use checked_div for mean weight |
| rs/types/types/src/consensus/idkg.rs | Use .values() to iterate configs |
| rs/tests/networking/http_endpoints_public_spec_test.rs | Simplify extend usage |
| rs/tests/message_routing/xnet/slo_test_lib/xnet_slo_test_lib.rs | Safe avg latency via checked_div |
| rs/tests/dre/utils/steps/update_subnet_type.rs | Remove redundant into_iter() |
| rs/tests/ckbtc/src/adapter.rs | Simplify chain(results) iteration |
| rs/tests/ckbtc/ckdoge_minter_basics_test.rs | Use match guard for condition |
| rs/state_manager/src/checkpoint.rs | Use .values() for snapshot ids |
| rs/state_machine_tests/src/lib.rs | Simplify zip iterator inputs |
| rs/sns/governance/src/proposal.rs | Simplify extend iterator inputs |
| rs/sns/governance/src/following.rs | Simplify extend iterator inputs |
| rs/rust_canisters/messaging_test/src/main.rs | Simplify zip(calls) iteration |
| rs/rosetta-api/icrc1/tests/system_tests.rs | Allow Clippy explicit counter loop |
| rs/rosetta-api/icrc1/tests/multitoken_system_tests.rs | Allow Clippy explicit counter loop |
| rs/rosetta-api/icrc1/src/data_api/services.rs | Use sort_by_key(Reverse(..)) |
| rs/rosetta-api/icp/src/request_handler.rs | Use sort_by_key(Reverse(..)) |
| rs/rosetta-api/icp/ledger_canister_blocks_synchronizer/src/blocks.rs | Use sort_by_key for tuples |
| rs/replicated_state/src/canister_state/queues.rs | Use while let Some(..) loop |
| rs/registry/regedit/src/lib.rs | Use sort_by_key for versions |
| rs/registry/canister/src/mutations/firewall.rs | Use sort_by_key for stable sort |
| rs/registry/canister/src/invariants/assignment.rs | Use .into_values() for membership |
| rs/recovery/subnet_splitting/src/subnet_splitting.rs | Use match guards for prompts |
| rs/recovery/src/nns_recovery_same_nodes.rs | Use match guards for prompts |
| rs/recovery/src/nns_recovery_failover_nodes.rs | Use match guards for prompts |
| rs/recovery/src/app_subnet_recovery.rs | Use match guards for prompts |
| rs/query_stats/src/payload_builder.rs | Simplify extend(stat2.clone()) |
| rs/p2p/state_sync_manager/tests/common.rs | Use .keys().filter(..) pattern |
| rs/p2p/consensus_manager/tests/test.rs | Simplify zip(cms) iteration |
| rs/p2p/artifact_downloader/src/fetch_stripped_artifact/stripper.rs | Use .values() over map entries |
| rs/nns/test_utils/src/state_test_helpers.rs | Simplify extend(new_response...) |
| rs/nns/integration_tests/src/node_provider_remuneration.rs | Use .into_values() for nodes map |
| rs/nns/governance/tests/governance.rs | Use sort_by_key for neuron ids |
| rs/nns/governance/src/governance/benches.rs | Simplify .chain(clone()) iteration |
| rs/nns/governance/src/governance.rs | Use match guards for validation |
| rs/nns/cmc/src/main.rs | Use checked_div for average rate |
| rs/nervous_system/integration_tests/tests/sns_lifecycle.rs | Simplify stream iter + sort key |
| rs/nervous_system/agent/src/sns/swap.rs | Simplify extend(...) iteration |
| rs/monitoring/adapter_metrics/server/src/lib.rs | Allow Clippy result_large_err |
| rs/ledger_suite/tests/sm-tests/src/lib.rs | Simplify chain/zip iterator inputs |
| rs/ledger_suite/icrc1/ledger/tests/tests.rs | Simplify zip(expected_res.blocks) |
| rs/ledger_suite/icrc1/index-ng/tests/tests.rs | Simplify zip(index_blocks.blocks) |
| rs/ledger_suite/icrc1/index-ng/src/main.rs | Allow Clippy explicit counter loop |
| rs/ledger_suite/icrc1/archive/src/main.rs | Allow Clippy explicit counter loop |
| rs/ledger_suite/icp/ledger/tests/tests.rs | Simplify zip and iteration |
| rs/ledger_suite/icp/index/tests/tests.rs | Simplify zip iteration |
| rs/ledger_suite/icp/index/src/main.rs | Allow Clippy explicit counter loop |
| rs/interfaces/mocks/src/crypto.rs | Crate-level allow result_large_err |
| rs/https_outcalls/consensus/src/pool_manager.rs | Allow result_large_err in test |
| rs/execution_environment/src/scheduler/tests/scheduling.rs | Use checked_div for rounds |
| rs/ethereum/ledger-suite-orchestrator/src/logs/mod.rs | Use sort_by_key + Reverse |
| rs/ethereum/cketh/test_utils/src/lib.rs | Use sort_by_key for log idx |
| rs/ethereum/cketh/minter/src/logs.rs | Use sort_by_key + Reverse |
| rs/crypto/tests/canister_threshold_idkg.rs | Simplify .chain(target_subnet_nodes) |
| rs/crypto/internal/crypto_lib/threshold_sig/bls12_381/src/ni_dkg/fs_ni_dkg/nizk_chunking.rs | Replace manual counter with zip |
| rs/consensus/idkg/src/test_utils.rs | Use .values() over map entries |
| rs/consensus/certification/src/certifier.rs | Use sort_by_key for heights |
| rs/bitcoin/ckbtc/minter/tests/tests.rs | Use sort_by_key for log idx |
| rs/bitcoin/ckbtc/minter/src/lib.rs | Simplify zip(fees) iteration |
| rs/bitcoin/adapter/src/rpc_server.rs | Allow result_large_err for TryFrom |
| rs/bitcoin/adapter/src/blockchainstate.rs | Use sort_by_key(Reverse(..)) |
| packages/canlog/src/lib.rs | Use sort_by_key + Reverse |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daniel-wong-dfinity-org-twin
left a comment
There was a problem hiding this comment.
Is this a duplicate? The changes here look very familiar...
Bas proposed to split out the Rust code changes to avoid conflicts if the Rust compiler version bump needs to be reverted. |
This PR prepares for a rustc version bump to v1.95.0 by making all the Rust changes required for the new version. It is a separate PR so that reverting the rustc version bump (if needed) does not create conflicts.