Skip to content

chore: use derives instead manual impl for trivial derefs#6429

Merged
LesnyRumcajs merged 1 commit intomainfrom
use-derive-more-for-derefs
Jan 15, 2026
Merged

chore: use derives instead manual impl for trivial derefs#6429
LesnyRumcajs merged 1 commit intomainfrom
use-derive-more-for-derefs

Conversation

@LesnyRumcajs
Copy link
Copy Markdown
Member

@LesnyRumcajs LesnyRumcajs commented Jan 15, 2026

Summary of changes

Changes introduced in this pull request:

  • use automagical derives from derive_more instead of manual implementations.
  • I'll check out more in follow up, I guess we can reduce some existing boilerplate, especially in shims, effectively increasing code coverage.

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Summary by CodeRabbit

  • Refactor
    • Optimized internal trait implementations across multiple wrapper types by using automatic derivations instead of manual implementations, reducing code duplication and improving maintainability. Public API behavior remains unchanged.

✏️ Tip: You can customize this high-level summary in your review settings.

@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner January 15, 2026 18:34
@LesnyRumcajs LesnyRumcajs requested review from hanabi1224 and sudo-shashank and removed request for a team January 15, 2026 18:34
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 15, 2026

Walkthrough

Replace manual Deref and DerefMut trait implementations with automatic derivations using derive_more across multiple wrapper types in RPC and shim modules, simplifying code while maintaining equivalent public behavior.

Changes

Cohort / File(s) Summary
EthBytes (RPC)
src/rpc/methods/eth/types.rs
Added derive_more::Deref derive; removed explicit Deref impl block
Version & Address (Shim)
src/shim/version.rs, src/shim/address.rs
Added derive_more::Deref and derive_more::DerefMut derives; removed manual impl blocks for both types; removed unused std::ops imports
BigInt, TokenAmount & Randomness (Shim)
src/shim/bigint.rs, src/shim/econ.rs, src/shim/randomness.rs
Added derive_more::Deref and derive_more::DerefMut derives; removed explicit impl blocks; simplified imports by removing Deref/DerefMut from std::ops
Sector Types (Shim)
src/shim/sector.rs
Added derive_more::Deref to RegisteredSealProof, SectorInfo, RegisteredPoStProof, ExtendedSectorInfo, and PoStProof; removed five manual Deref impl blocks
ActorState (State Tree)
src/shim/state_tree.rs
Added derive_more::Deref and derive_more::DerefMut derives; removed explicit impl blocks; simplified imports

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

RPC

Suggested reviewers

  • akaladarshi
  • elmattic
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: replacing manual Deref/DerefMut implementations with derive_more derives across multiple files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Jan 15, 2026
Merged via the queue into main with commit ebd6f37 Jan 15, 2026
42 checks passed
@LesnyRumcajs LesnyRumcajs deleted the use-derive-more-for-derefs branch January 15, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants