Skip to content

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Nov 4, 2025

Summary of changes

Changes introduced in this pull request:

warning: this `impl` can be derived
  --> src/utils/misc/mod.rs:30:1
   |
30 | / impl Default for LoggingColor {
31 | |     fn default() -> Self {
32 | |         Self::Auto
33 | |     }
34 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#derivable_impls
help: replace the manual implementation with a derive attribute and mark the default variant
   |
14 + #[derive(Default)]
15 ~ pub enum LoggingColor {
16 |     Always,
17 ~     #[default]
18 ~     Auto,
   |

warning: use of deprecated associated function `assert_cmd::Command::cargo_bin`: incompatible with a custom cargo build-dir, see instead `cargo::cargo_bin_cmd!`
  --> tests/common/mod.rs:18:14
   |
18 |     Command::cargo_bin("forest").unwrap()

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

  • Chores

    • Updated Rust toolchain to version 1.91.0
    • Bumped dependency versions including hashlink, console-subscriber, and development dependencies for improved stability and compatibility
  • Refactor

    • Simplified internal code by adopting derived Default trait implementations across multiple components, reducing boilerplate code

@hanabi1224 hanabi1224 marked this pull request as ready for review November 4, 2025 08:12
@hanabi1224 hanabi1224 requested a review from a team as a code owner November 4, 2025 08:12
@hanabi1224 hanabi1224 requested review from akaladarshi and sudo-shashank and removed request for a team November 4, 2025 08:12
@hanabi1224 hanabi1224 added the RPC requires calibnet RPC checks to run on CI label Nov 4, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

This PR updates dependency versions in Cargo.toml, bumps the Rust toolchain to 1.91.0, and replaces explicit impl Default implementations with derived defaults using the #[default] attribute across multiple enums. Additionally, test utilities are updated to use the cargo_bin_cmd! macro instead of direct Command::cargo_bin() calls.

Changes

Cohort / File(s) Summary
Dependency and Toolchain Updates
Cargo.toml, rust-toolchain.toml
Bumped workspace dependencies: hashlink (0.10→0.11), console-subscriber (0.4→0.5); dev-dependencies: ariadne (0.5→0.6), ra_ap_syntax (0.0.301→0.0.304). Updated Rust toolchain from 1.90.0 to 1.91.0.
Default Trait Derivations
src/networks/mod.rs, src/rpc/methods/sync/types.rs, src/rpc/reflect/mod.rs, src/utils/misc/mod.rs
Replaced explicit impl Default with derive(Default) and #[default] attribute across Height, SnapshotProgressState, ApiPaths, and LoggingColor enums.
Test Utilities Macro Migration
tests/common/mod.rs
Replaced direct Command::cargo_bin() calls with cargo_bin_cmd! macro for forest-cli, forest-tool, and forest binaries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Dependency version bumps are straightforward mechanical updates
  • Default trait refactoring follows a consistent, repetitive pattern across multiple files (same derive+attribute approach applied uniformly)
  • Macro migration is a straightforward replacement with no behavioral changes

Possibly related PRs

Suggested labels

rust, dependencies

Suggested reviewers

  • LesnyRumcajs
  • elmattic
  • sudo-shashank

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately reflects the primary change: upgrading Rust toolchain from 1.90.0 to 1.91.0, which is the main motivator for the dependency updates and Clippy warning fixes throughout the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hm/rust-1.91

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 717af47 and cfa8679.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • Cargo.toml (4 hunks)
  • rust-toolchain.toml (1 hunks)
  • src/networks/mod.rs (1 hunks)
  • src/rpc/methods/sync/types.rs (1 hunks)
  • src/rpc/reflect/mod.rs (2 hunks)
  • src/utils/misc/mod.rs (1 hunks)
  • tests/common/mod.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5867
File: src/ipld/util.rs:553-558
Timestamp: 2025-08-08T12:10:45.218Z
Learning: Forest pins Rust toolchain to 1.89.0 via rust-toolchain.toml; features stabilized in 1.88 (e.g., let-chains) are acceptable in this codebase.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5867
File: src/ipld/util.rs:553-558
Timestamp: 2025-08-08T12:10:45.218Z
Learning: Forest project targets Rust stable >=1.89; features stabilized in 1.88 like let-chains are acceptable in this codebase.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-08-08T12:10:45.218Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5867
File: src/ipld/util.rs:553-558
Timestamp: 2025-08-08T12:10:45.218Z
Learning: Forest pins Rust toolchain to 1.89.0 via rust-toolchain.toml; features stabilized in 1.88 (e.g., let-chains) are acceptable in this codebase.

Applied to files:

  • rust-toolchain.toml
  • Cargo.toml
  • tests/common/mod.rs
📚 Learning: 2025-08-08T12:10:45.218Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5867
File: src/ipld/util.rs:553-558
Timestamp: 2025-08-08T12:10:45.218Z
Learning: Forest project targets Rust stable >=1.89; features stabilized in 1.88 like let-chains are acceptable in this codebase.

Applied to files:

  • rust-toolchain.toml
  • Cargo.toml
  • tests/common/mod.rs
📚 Learning: 2025-10-17T09:36:15.757Z
Learnt from: elmattic
Repo: ChainSafe/forest PR: 6128
File: src/ipld/util.rs:23-30
Timestamp: 2025-10-17T09:36:15.757Z
Learning: Always run `cargo check` or `cargo build` to verify actual compilation errors in the Forest codebase before flagging them as issues. Do not rely solely on documentation or assumptions about trait implementations.

Applied to files:

  • tests/common/mod.rs
📚 Learning: 2025-08-07T13:39:15.107Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: interop-tests/src/tests/go_app/gen.go:29-29
Timestamp: 2025-08-07T13:39:15.107Z
Learning: Auto-generated files like those created by rust2go (indicated by "Generated by rust2go. Please DO NOT edit this C part manually." comment) in the Forest project should be skipped during code review as they are not intended for manual editing.

Applied to files:

  • tests/common/mod.rs
📚 Learning: 2025-09-11T16:03:14.328Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/tool/subcommands/api_cmd/state_decode_params_tests/miner.rs:4-9
Timestamp: 2025-09-11T16:03:14.328Z
Learning: In the Forest codebase's state_decode_params_tests module, common imports like `to_vec`, `TokenAmount`, `Cid`, etc. are centralized in the mod.rs file and made available to submodules through `use super::*;`, eliminating the need for duplicate imports in individual test files.

Applied to files:

  • tests/common/mod.rs
📚 Learning: 2025-08-07T13:39:29.732Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: interop-tests/src/tests/go_app/gen.go:58-58
Timestamp: 2025-08-07T13:39:29.732Z
Learning: In the Forest project, auto-generated files (like those generated by rust2go tool) should be skipped during code review as they are not meant to be manually edited.

Applied to files:

  • tests/common/mod.rs
📚 Learning: 2025-08-28T12:52:46.927Z
Learnt from: LesnyRumcajs
Repo: ChainSafe/forest PR: 6011
File: src/cli/main.rs:18-25
Timestamp: 2025-08-28T12:52:46.927Z
Learning: In Forest CLI (src/cli/main.rs), the early RPC network check before Cli::parse_from() does not block help/version commands because clap processes these internally before reaching the RPC call. LesnyRumcajs confirmed this implementation works correctly and that RPC call failures are acceptable in this context.

Applied to files:

  • tests/common/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: All lint checks
🔇 Additional comments (1)
src/rpc/methods/sync/types.rs (1)

10-20: LGTM! Idiomatic refactor to derive Default.

The change from explicit impl Default to #[derive(Default)] with #[default] on the Initializing variant is the preferred Rust pattern since 1.62.0. This maintains the same behavior while making the code more concise and addressing Clippy's suggestion.


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

Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

❤️ 🦀

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Nov 4, 2025
Merged via the queue into main with commit cfd32ad Nov 4, 2025
47 of 71 checks passed
@LesnyRumcajs LesnyRumcajs deleted the hm/rust-1.91 branch November 4, 2025 09:13
@coderabbitai coderabbitai bot mentioned this pull request Dec 12, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants