[rust-toolchain] Upgrade Rust toolchain to 1.95.0#5175
[rust-toolchain] Upgrade Rust toolchain to 1.95.0#5175eval-exec wants to merge 4 commits intonervosnetwork:developfrom
Conversation
Update the repositorys direct Rust version pins to 1.95.0. This changes rust-toolchain.toml, the root Cargo.toml rust-version, and the GitHub Actions jobs that install Rust directly so local development and CI use the same compiler series. It intentionally does not touch the package builder image tags yet, because the upstream ckb-docker-builder repository still targets 1.92.0 and changing those references here would point packaging at images that are not ready.
Adjust handwritten code that started failing under the Rust 1.95.0 clippy lint set. These edits remove redundant iterator conversions, collapse match/if patterns that the newer clippy flags, and replace an is_some/expect pair with direct option binding in fee-rate collection. The goal is only to keep behavior unchanged while making `make clippy` pass after the toolchain bump, so generated code and unrelated files are left untouched.
7c753ac to
55752b6
Compare
Replace the deprecated `tower_http::timeout::TimeoutLayer::new` call with `TimeoutLayer::with_status_code` in the RPC server setup. This keeps the 30-second timeout behavior while making `make clippy` pass again after the dependency update pulled in a newer tower-http that warns on the old constructor.
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repository’s Rust toolchain baseline to 1.95.0 and applies code adjustments needed to keep make clippy passing under the newer compiler, along with a cargo update refresh of Cargo.lock.
Changes:
- Bump Rust toolchain pins to 1.95.0 across
rust-toolchain.toml, rootCargo.toml, and GitHub Actions workflows. - Apply small Rust/clippy-driven refactors (iterator usage, match ergonomics, RPC timeout configuration, fee-rate collection logic).
- Update
Cargo.lockviacargo update.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| util/reward-calculator/src/lib.rs | Removes redundant .into_iter() usage when extending proposal IDs. |
| util/indexer/src/indexer.rs | Simplifies match logic when extracting a stored header hash. |
| util/fixed-hash/macros/src/lib.rs | Refactors macro parsing logic using match guards. |
| tx-pool/src/process.rs | Refactors match in async notification path (currently introduces a compile error). |
| test/src/specs/dao/dao_verifier.rs | Removes redundant .into_iter() in zipped iteration over outputs. |
| sync/src/synchronizer/mod.rs | Refactors match arm using a guard for readability. |
| spec/src/tests/mod.rs | Removes redundant .into_iter() when zipping outputs and outputs_data. |
| shared/src/shared_builder.rs | Removes redundant .into_iter() usage when extending proposal IDs. |
| rust-toolchain.toml | Updates pinned Rust toolchain channel to 1.95.0. |
| rpc/src/util/fee_rate.rs | Refactors BlockExt field handling and cycles presence checks. |
| rpc/src/server.rs | Changes request timeout layer configuration to return a 408 status on timeout. |
| Cargo.toml | Updates root rust-version to 1.95.0. |
| Cargo.lock | Updates dependency lockfile after cargo update. |
| .github/workflows/release-plz.yml | Updates CI toolchain to 1.95.0. |
| .github/workflows/coverage_report.yaml | Updates CI toolchain to 1.95.0. |
| .github/workflows/ci_unit_tests_ubuntu.yaml | Updates CI toolchain to 1.95.0. |
| .github/workflows/ci_quick_checks_ubuntu.yaml | Updates CI toolchain to 1.95.0. |
| .github/workflows/ci_linters_ubuntu.yaml | Updates CI toolchain to 1.95.0. |
| .github/workflows/ci_integration_tests_ubuntu.yaml | Updates CI toolchain to 1.95.0. |
| .github/workflows/ci_cargo_deny_ubuntu.yaml | Updates CI toolchain to 1.95.0. |
| .github/workflows/ci_benchmarks_ubuntu.yaml | Updates CI toolchain to 1.95.0. |
| .github/workflows/ci_aarch64_build_ubuntu.yaml | Updates CI toolchain to 1.95.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pub(crate) async fn notify_block_assembler(&self, status: TxStatus) { | ||
| if self.should_notify_block_assembler() { | ||
| match status { | ||
| TxStatus::Fresh => { | ||
| TxStatus::Fresh | ||
| if self | ||
| .block_assembler_sender | ||
| .send(BlockAssemblerMessage::Pending) | ||
| .await | ||
| .is_err() | ||
| { | ||
| error!("block_assembler receiver dropped"); | ||
| } | ||
| .is_err() => | ||
| { | ||
| error!("block_assembler receiver dropped"); | ||
| } | ||
| TxStatus::Proposed => { | ||
| TxStatus::Proposed | ||
| if self | ||
| .block_assembler_sender | ||
| .send(BlockAssemblerMessage::Proposed) | ||
| .await | ||
| .is_err() | ||
| { | ||
| error!("block_assembler receiver dropped"); | ||
| } | ||
| .is_err() => | ||
| { | ||
| error!("block_assembler receiver dropped"); |
There was a problem hiding this comment.
This match arm uses an if guard that awaits (.await) inside the guard expression. Rust does not allow await in match guards, so this will not compile. Consider rewriting to match on status without a guard and perform the async send().await inside the arm body (or use a match on status plus an inner if/let for the send result).
| description = "CKB is the layer 1 of Nervos Network, a public/permissionless blockchain" | ||
| homepage = "https://github.com/nervosnetwork/ckb" | ||
| repository = "https://github.com/nervosnetwork/ckb" | ||
| rust-version = "1.92.0" | ||
| rust-version = "1.95.0" | ||
| default-run = "ckb" |
There was a problem hiding this comment.
Only the root package rust-version was bumped to 1.95.0, but many workspace member crates still declare rust-version = "1.92.0" (e.g. rpc/Cargo.toml, tx-pool/Cargo.toml, etc.). If the intent is to raise the workspace MSRV/toolchain baseline, consider updating the member crates as well (or centralizing MSRV via a workspace-level approach) to keep the declared MSRV consistent across the repo.
What problem does this PR solve?
https://releases.rs/docs/1.95.0/
Problem Summary: Upgrade direct Rust pins to
1.95.0and fix the clippy failures exposed by Rust1.95.0.What is changed and how it works?
What's Changed:
1.95.0make clippynervosnetwork/ckb-docker-builderstill needs a1.95.0update before package image tags can movecargo updatefor./Cargo.lockCheck List
Tests
make clippySide effects