Skip to content

fix: unused TextModelArch import when luxtts feature is disabled - #88

Open
SAGAR-TAMANG wants to merge 1 commit into
evilsocket:mainfrom
SAGAR-TAMANG:fix/unused-import-without-luxtts
Open

fix: unused TextModelArch import when luxtts feature is disabled#88
SAGAR-TAMANG wants to merge 1 commit into
evilsocket:mainfrom
SAGAR-TAMANG:fix/unused-import-without-luxtts

Conversation

@SAGAR-TAMANG

Copy link
Copy Markdown

Problem

TextModelArch is imported unconditionally in cake-cli/src/main.rs:10, but its only use site is inside a #[cfg(feature = "luxtts")] block in run_master (cake-cli/src/main.rs:321). Building the CLI without that feature warns:

warning: unused import: `TextModelArch`
  --> cake-cli/src/main.rs:10:45
   |
10 |     utils, Args, ImageModelArch, ModelType, TextModelArch,
   |                                             ^^^^^^^^^^^^^

Reproduce:

cargo build --release -p cake-cli --no-default-features \
  --features "master,llama,qwen2,qwen3"

This breaks the zero-warning clippy requirement in CLAUDE.md for any reduced-feature build of the CLI.

Why it went unnoticed

luxtts is in the default feature set, so the import is always used in a normal build. And no CI job builds cake-cli with --no-default-features:

  • the clippy job (ci.yml:294) lints cake-cli with default features plus vulkan,rocm
  • the test-android job builds with reduced features, but only targets cake-core and cake-mobile — never the CLI
  • the same is true of test-ios

Fix

Drop the import and fully qualify the path at the use site, matching the adjacent cake_core::dispatch_text_model! call:

-    utils, Args, ImageModelArch, ModelType, TextModelArch,
+    utils, Args, ImageModelArch, ModelType,
     #[cfg(feature = "luxtts")]
-    if ctx.text_model_arch == TextModelArch::LuxTTS {
+    if ctx.text_model_arch == cake_core::TextModelArch::LuxTTS {

This stays valid under every feature combination and avoids adding a second #[cfg] attribute that would have to be kept in sync with the one at the use site.

Verification

Relying on the existing clippy job to confirm the default-feature build is unaffected, since removing an import is the direction that could regress. Not yet built locally with the full default feature set.

Context

Found while building for Termux/Android on-device, where a reduced feature set is necessary to keep compile time and memory usage in range.

Happy to follow up with a CI step that covers this configuration so it can't regress:

- name: Clippy (cake-cli, minimal features)
  run: cargo clippy -p cake-cli --no-default-features --features "master,llama,qwen2,qwen3" -- -D warnings

🤖 Generated with Claude Code

`TextModelArch` is imported unconditionally in cake-cli/src/main.rs, but its
only use site is inside a `#[cfg(feature = "luxtts")]` block in `run_master`.
Building the CLI without that feature produces:

    warning: unused import: `TextModelArch`
      --> cake-cli/src/main.rs:10:45

Reproduce with:

    cargo build --release -p cake-cli --no-default-features \
      --features "master,llama,qwen2,qwen3"

This goes unnoticed because `luxtts` is in the default feature set, and the
Android CI job builds cake-core with reduced features but only ever builds
cake-mobile -- never cake-cli. It breaks the zero-warning clippy requirement
in CLAUDE.md for any reduced-feature build.

Fixed by dropping the import and fully qualifying the path at the use site,
matching the adjacent `cake_core::dispatch_text_model!` call. This keeps the
fix valid under every feature combination without adding a second `#[cfg]`
attribute that has to stay in sync with the first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant