Skip to content

chore - Bump MSRV/toolchain to stable 1.93 and fix strict clippy#530

Open
mingley wants to merge 1 commit intotikv:masterfrom
mingley:mingley/bump-rust-version-1-93
Open

chore - Bump MSRV/toolchain to stable 1.93 and fix strict clippy#530
mingley wants to merge 1 commit intotikv:masterfrom
mingley:mingley/bump-rust-version-1-93

Conversation

@mingley
Copy link

@mingley mingley commented Feb 6, 2026

Summary

This PR upgrades the repository toolchain/MSRV to Rust 1.93.0 and applies strict-clippy compatibility fixes while preserving runtime behavior and public API compatibility.

Quality objective:

  • keep the codebase clean under -D warnings,
  • avoid unintended semantic changes,
  • maintain Error::GrpcAPI usability for downstream code.

Rationale

Problem statement

Moving to Rust 1.93 and strict clippy surfaced new lints in generated/protocol and request/transaction paths. A prior approach introduced awkward conditional typing for Error::GrpcAPI; this PR keeps the API representation stable and solves lint pressure in a clearer way.

Design changes

  • Toolchain/MSRV:
    • Cargo.toml: rust-version = "1.93.0"
    • rust-toolchain.toml: channel 1.93.0
  • Error::GrpcAPI compatibility:
    • keep payload as tonic::Status (single representation),
    • keep From<tonic::Status> for Error conversion path,
    • remove cfg(clippy) payload-type split.
  • Lint strategy for large error payload:
    • targeted #![allow(clippy::result_large_err)] in src/lib.rs and examples/raw.rs.
  • Clippy cleanup (behavior-preserving simplifications):
    • remove redundant conversions,
    • replace repeat(...).take(...) with repeat_n(...),
    • narrow generated-code dead-code handling in src/proto.rs.

Risk analysis

  • Primary risk: accidental API/behavior drift during lint cleanup.
  • Mitigation:
    • explicit tests for error conversion and variant behavior,
    • full format/clippy/test gates.

File Scope

  • Cargo.toml
  • rust-toolchain.toml
  • src/common/errors.rs
  • src/lib.rs
  • examples/raw.rs
  • src/proto.rs
  • src/pd/retry.rs
  • src/store/request.rs
  • src/transaction/requests.rs
  • src/transaction/transaction.rs
  • tests/integration_tests.rs

Testing Done

Executed locally:

  1. cargo fmt -> pass
  2. cargo clippy --all-targets --all-features -- -D warnings -> pass
  3. cargo test -> pass

Added/maintained regression coverage in src/common/errors.rs:

  • from_tonic_status_produces_grpc_api_error
  • grpc_api_variant_accepts_tonic_status_payload
  • from_proto_region_error_wraps_region_error
  • from_proto_key_error_wraps_key_error

Compatibility

  • Public Error::GrpcAPI construction/pattern behavior remains compatible (tonic::Status payload).
  • No intentional runtime behavior change beyond lint/toolchain conformance.

Summary by CodeRabbit

  • Chores

    • Updated minimum Rust toolchain to 1.93.0 and declared rust-version.
  • Improvements

    • Improved gRPC error conversion and handling.
    • Optimized internal data transformation steps to reduce unnecessary conversions.
    • Updated lint allowances for compatibility with Rust 1.93.0.
  • Tests

    • Added unit tests validating gRPC error conversion behavior.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 6, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign you06 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Feb 6, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Bump Rust toolchain to 1.93.0 and add crate-level/clippy allowances; adjust error enum to take a plain tonic::Status with an explicit From<tonic::Status> impl and tests; simplify several places by removing element-wise Into::into conversions and switching to iter::repeat_n; add #[allow(dead_code)] for protos.

Changes

Cohort / File(s) Summary
Toolchain / Manifests
Cargo.toml, rust-toolchain.toml
Set package rust-version = "1.93.0" and bump rust-toolchain channel to 1.93.0.
Error handling & tests
src/common/errors.rs
Changed Error::GrpcAPI variant to hold tonic::Status (removed #[from]), added impl From<tonic::Status> for Error and a #[cfg(test)] test module verifying conversions.
Clippy / Lint allowances
src/lib.rs, examples/raw.rs
Added #[allow(clippy::result_large_err)] at crate/examples level; existing crate lint allow retained.
Protobuf handling
src/proto.rs
Added #[allow(dead_code)] to internal protos module to suppress clippy warnings for generated types.
Request error mapping
src/store/request.rs
Switched error mapping from map_err(Error::GrpcAPI) to map_err(Error::from).
Collection & iterator simplifications
src/pd/retry.rs, src/transaction/requests.rs, src/transaction/transaction.rs, tests/integration_tests.rs
Removed unnecessary per-item Into::into conversions when collecting, replaced iter::repeat(...).take(len) with iter::repeat_n(..., len) in relevant places, and simplified other iterator mappings to directly use underlying types.
Examples / lint
examples/raw.rs
Added #![allow(clippy::result_large_err)] to suppress a specific clippy lint in the example.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped to the toolchain, nudged it anew,

Rust 1.93 — a bright, tidy view.
Errors unboxed, conversions made plain,
Repeats shortened, iterators lean.
Code and clippy now dance in one lane.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore - Bump MSRV/toolchain to stable 1.93 and fix strict clippy' directly summarizes the two main changes: upgrading Rust to 1.93 and addressing clippy linting issues.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ti-chi-bot ti-chi-bot bot added contribution This PR is from a community contributor. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 6, 2026
@mingley
Copy link
Author

mingley commented Feb 6, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 6, 2026
@mingley
Copy link
Author

mingley commented Feb 6, 2026

Addressed local review findings #2 and #3 in cfad559:

  • Removed crate-wide/example clippy::result_large_err suppressions.
  • Replaced Error::GrpcAPI(tonic::Status) with boxed storage + explicit From<tonic::Status> so API signatures remain unchanged while reducing error size pressure.
  • Dropped generated-file rewrite logic from proto-build/src/main.rs.
  • Moved dead-code suppression to generated module boundary in src/proto.rs with explicit “why now vs before” context comment.

Also added a dedicated "Follow-on PR Callout: Dependency Modernization" section to the PR description with major version gaps and rationale.

@mingley mingley changed the title Bump MSRV/toolchain to stable 1.93 and fix strict clippy chore - Bump MSRV/toolchain to stable 1.93 and fix strict clippy Feb 6, 2026
@ti-chi-bot ti-chi-bot bot added dco-signoff: no Indicates the PR's author has not signed dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. dco-signoff: yes Indicates the PR's author has signed the dco. labels Feb 11, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/common/errors.rs`:
- Around line 202-211: The test grpc_api_variant_accepts_tonic_status_payload is
gated with #[cfg(not(clippy))], causing it to be skipped under cargo clippy;
remove the #[cfg(not(clippy))] attribute so the test always runs, and ensure it
still passes after applying the unconditional boxing change mentioned in the
surrounding comments (the test constructs Error::GrpcAPI from tonic::Status and
asserts status.code() and status.message()).
- Around line 11-14: The conditional type alias GrpcApiErrorPayload causes
divergent in-memory representations under clippy vs normal builds; make the
payload unconditionally boxed by changing the alias to "type GrpcApiErrorPayload
= Box<tonic::Status>;" so Error::GrpcAPI has a consistent, smaller enum variant
across all builds, then remove the #[cfg(not(clippy))] gating from tests that
construct Error::GrpcAPI (the test that conditionally constructs GrpcAPI can now
use Error::GrpcAPI(status) directly) and consider removing the now-redundant
#[allow(clippy::large_enum_variant)] if no longer needed.

@mingley mingley force-pushed the mingley/bump-rust-version-1-93 branch from 0a5504c to 98a9dcb Compare February 11, 2026 12:44
@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. and removed dco-signoff: no Indicates the PR's author has not signed dco. labels Feb 11, 2026
@mingley mingley force-pushed the mingley/bump-rust-version-1-93 branch from 98a9dcb to affc0d5 Compare February 11, 2026 13:22
Signed-off-by: Michael Ingley <michael.ingley@gmail.com>
@mingley mingley force-pushed the mingley/bump-rust-version-1-93 branch from affc0d5 to d63fe2b Compare February 11, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant