Skip to content

Eliminate warnings in gif-only builds - #285

Open
mhoev wants to merge 1 commit into
fschutt:masterfrom
mhoev:fix/gif-feature-warnings
Open

Eliminate warnings in gif-only builds#285
mhoev wants to merge 1 commit into
fschutt:masterfrom
mhoev:fix/gif-feature-warnings

Conversation

@mhoev

@mhoev mhoev commented Aug 28, 2026

Copy link
Copy Markdown

Summary

Eliminate the compiler warnings produced by this reduced-feature build:

cargo check --no-default-features --features gif

Root cause

With default features disabled, gif enables the images feature but does not
enable html or text_layout. Several imports, helpers, and parameters were
therefore compiled in configurations where their consumers were absent.

Two closure bindings were also marked mutable even though the closures do not
mutate their captured state.

Together, these produced 11 unused-code and unnecessary-mut warnings.

Changes

  • Gate the Op import and Type 1 font helper on text_layout.
  • Gate the registered-font merge helper on html.
  • Compile the raw-image fallback encoder only when images is disabled, matching
    its existing call site.
  • Prefix parameters that are intentionally unused in reduced-feature builds with
    underscores, while preserving their use in feature-enabled builds.
  • Remove two unnecessary mut qualifiers.

No warning lints are suppressed, public signatures are unchanged, and runtime
behavior is preserved.

Verification

All Cargo commands were run with RUSTFLAGS="-D warnings":

cargo check --no-default-features --features gif --all-targets
cargo check --no-default-features
cargo check --no-default-features --features images
cargo check --no-default-features --features text_layout
cargo check

cargo test --no-default-features --features gif
cargo test --no-default-features
cargo test --lib

git diff --check also passes.

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