Skip to content

Derive the transition effect count and variant inventory - #496

Merged
eval-exec merged 1 commit into
mainfrom
refactor/transition-effect-inventory
Oct 7, 2026
Merged

eval-exec merged 1 commit into
mainfrom
refactor/transition-effect-inventory

Conversation

@eval-exec

Copy link
Copy Markdown
Owner

Adding a TransitionEffect currently requires updating both the enum declaration and its handwritten COUNT and ALL inventory. Derive the inventory with the existing strum::EnumCount and strum::VariantArray macros so new variants are included automatically.

Preserve the public fixed-size ALL array, declaration order, parsing aliases, canonical names, and serialization. No dependencies are added.

Validation:

  • cargo test --locked -p neomacs-display-protocol --lib: all 851 tests passed.
  • Compared all 21 declared variants against the previous ALL array: ordering is unchanged.
  • Rustfmt and git diff --check passed.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 16:15
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aeb31655-9a10-4328-91cd-64436718781d
📥 Commits

Reviewing files that changed from the base of the PR and between 853bcd6 and e9a9616.

📒 Files selected for processing (1)
  • crates/neomacs-display-protocol/src/scroll_animation.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

TransitionEffect now derives its variant array and count. Its public COUNT and ALL constants use those derived values.

Changes

TransitionEffect metadata

Layer / File(s) Summary
Derived variant metadata
crates/neomacs-display-protocol/src/scroll_animation.rs
TransitionEffect derives VariantArray and EnumCount. COUNT uses the derived enum count, and ALL is populated from VariantArray::VARIANTS in variant-definition order.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to e9a96

This refactor derives the transition effect list and count from the enum definition without changing the public API shape. No actionable merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: deriving the transition effect count and variant inventory.
Description check ✅ Passed The description directly explains the inventory derivation, preserved behavior, and validation results for the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@eval-exec
eval-exec merged commit fc20e84 into main Oct 7, 2026
21 of 34 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is a small, self-contained refactor that preserves the public API, uses an established codebase pattern, is valid const Rust (enum is Copy), and is covered by existing tests for ALL and COUNT.

0 open findings

What changed in this PR

This PR refactors the TransitionEffect enum in scroll_animation.rs to derive its variant count (COUNT) and inventory (ALL) from the strum::EnumCount and strum::VariantArray macros, instead of maintaining them by hand. This removes a maintenance footgun where adding a new transition variant previously required manually updating the hardcoded COUNT = 21 and the 21-entry ALL array. The public API (COUNT, the fixed-size ALL array, parsing aliases, and serialization) is preserved, and no new dependencies are introduced since strum with the derive feature is already a workspace dependency.

Changes:

  • Added strum::EnumCount and strum::VariantArray to the enum's derives.
  • Replaced the hardcoded COUNT = 21 with <Self as strum::EnumCount>::COUNT.
  • Replaced the handwritten 21-entry ALL array with a const loop that copies strum's derived VARIANTS into the fixed-size array.
File Description
crates/​neomacs-display-protocol/​src/​scroll_animation.rs Derives COUNT and ALL for TransitionEffect via strum macros, removing the manually maintained count and variant list while preserving the public fixed-size array and ordering.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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