refactor: remove unused HasThresholdStyle impls and apply PR #108 sub-field boilerplate refactor#132
Open
stephenleo wants to merge 3 commits intomainfrom
Open
refactor: remove unused HasThresholdStyle impls and apply PR #108 sub-field boilerplate refactor#132stephenleo wants to merge 3 commits intomainfrom
stephenleo wants to merge 3 commits intomainfrom
Conversation
…sed HasThresholdStyle impls - Merged CostSubfieldConfig and ContextWindowSubfieldConfig into a unified SubfieldConfig struct with #[cfg(test)] type aliases for backward compat. - Added HasThresholdStyle trait and impl_has_threshold_style! macro to config.rs; only ContextWindowConfig gets an impl (the three unused CostConfig, ContextBarConfig, UsageLimitsConfig impls are intentionally absent per Story 3.1). - Added render_styled_value() to format.rs with six unit tests covering all paths (format, threshold, invert_threshold, parent fallback, no-sub/no-parent). - Replaced all inline threshold/style boilerplate in cost.rs (5 functions) and context_window.rs (8 functions) with render_styled_value() calls. - cargo build, cargo test (65/65), and cargo clippy -- -D warnings all exit 0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
1 similar comment
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CostSubfieldConfigandContextWindowSubfieldConfiginto a singleSubfieldConfigstruct insrc/config.rs, addsHasThresholdStyletrait andimpl_has_threshold_style!macro, and addsrender_styled_value()tosrc/format.rs.HasThresholdStyleimpls (CostConfig,ContextBarConfig,UsageLimitsConfig) — these were never cast to&dyn HasThresholdStyleanywhere in the codebase.src/modules/cost.rs(5 subfield functions) andsrc/modules/context_window.rs(8 subfield functions) withrender_styled_value()calls.Re-submission of PR #126 after revert.
Test plan
cargo buildexits 0 with no errorscargo testpasses all tests with no regressionscargo clippy -- -D warningsexits 0 (no new warnings introduced)impl HasThresholdStyle for ContextWindowConfigis the onlyHasThresholdStyleimpl (the used one)CostSubfieldConfigandContextWindowSubfieldConfigremain as#[cfg(test)]aliases for backward-compatible test code🤖 Generated with Claude Code