Skip to content

refactor(styling): move test-only import out of library code - #2668

Merged
max-sixty merged 2 commits into
mainfrom
fix/issue-2663-styling-test-only-reexport
May 10, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/issue-2663-styling-test-only-reexport

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

src/styling/mod.rs:34-35 had a #[cfg(all(test, feature = "syntax-highlighting"))] pub(crate) use format::format_bash_with_gutter_at_width; re-export whose only purpose was to let two snapshot tests in the same file's mod tests skip the format:: prefix. CLAUDE.md's "No Test Code in Library Code" guideline (CLAUDE.md) says test helpers belong in the test module — move the import inside mod tests (still feature-gated). The library surface no longer carries a test-only re-export.

Test plan

  • cargo test --lib styling (78 tests) passes
  • cargo build --no-default-features --features cli succeeds (verifies the feature gate still keeps the build clean when syntax-highlighting is off)

Closes part of #2663.

worktrunk-bot and others added 2 commits May 10, 2026 08:13
`mod.rs` carried a `#[cfg(all(test, feature = "syntax-highlighting"))]
pub(crate) use format::format_bash_with_gutter_at_width;` whose only
consumer is two snapshot tests in the same file's `mod tests`. CLAUDE.md's
"No Test Code in Library Code" rule asks us to import test helpers from
inside the test module, not the library surface. Move the import into
`mod tests` (still feature-gated so the build is unaffected when
syntax-highlighting is off).

Closes part of #2663.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@max-sixty
max-sixty merged commit 64ba8a9 into main May 10, 2026
31 checks passed
@max-sixty
max-sixty deleted the fix/issue-2663-styling-test-only-reexport branch May 10, 2026 14:58
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