Skip to content

chore: bump deps, add #[must_use], and unify transform dispatch#133

Merged
nao1215 merged 4 commits intomainfrom
chore/bump-deps-batch
Mar 13, 2026
Merged

chore: bump deps, add #[must_use], and unify transform dispatch#133
nao1215 merged 4 commits intomainfrom
chore/bump-deps-batch

Conversation

@nao1215
Copy link
Owner

@nao1215 nao1215 commented Mar 13, 2026

Summary

Test plan

  • cargo fmt --check passes
  • cargo clippy --all-features -- -D warnings passes
  • cargo test --all-features passes

Summary by CodeRabbit

  • Bug Fixes

    • Added media type validation to detect and prevent mismatches between declared and actual media types.
  • Refactor

    • Unified transformation code paths for both vector and raster formats into a single consolidated flow, improving code maintainability and consistency.
    • Enhanced compiler safety with explicit markers to ensure critical return values are properly handled by callers.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52254df6-db82-45a3-9141-71fcaad88e47

📥 Commits

Reviewing files that changed from the base of the PR and between 9418ec6 and 4078ba9.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • src/adapters/cli/convert.rs
  • src/adapters/server/handler.rs
  • src/adapters/server/mod.rs
  • src/adapters/wasm.rs
  • src/codecs/mod.rs
  • src/codecs/raster.rs
  • src/codecs/svg.rs
  • src/core.rs
  • src/lib.rs

📝 Walkthrough

Walkthrough

This PR consolidates SVG and raster transformation dispatch into a single unified transform() function in src/codecs/mod.rs, eliminating duplicated if/else branching across three adapters (CLI, server, WASM). Adds #[must_use] attributes to key public types and functions. Extends artifact sniffing with media type validation.

Changes

Cohort / File(s) Summary
Unified Transform Dispatcher
src/codecs/mod.rs, src/lib.rs
New public transform() function that centralizes SVG/raster routing logic with feature-gated SVG handling and output format validation. Exported at crate root for unified API access.
Adapter Refactoring
src/adapters/cli/convert.rs, src/adapters/server/handler.rs, src/adapters/server/mod.rs, src/adapters/wasm.rs
Replaced per-format branching (if/else for SVG vs raster) with single transform() calls. Updated imports to use unified transform instead of distinct transform_svg/transform_raster. Removed SVG-specific conditional compilation in WASM adapter.
Must-Use Attributes
src/codecs/raster.rs, src/codecs/svg.rs
Added #[must_use] markers to transform_raster() and transform_svg() to signal return values should not be discarded.
Core Type & Validation Enhancements
src/core.rs
Added #[must_use] to Artifact and Dimensions types. Extended sniff_artifact() with media type validation to detect mismatches between declared and detected types. Added #[must_use] message attribute to sniff_artifact().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #115: Directly implements the unified transform dispatch pattern described in the issue to eliminate SVG/raster routing duplication across adapters.
  • PR #130: Implements the #[must_use] attribute additions to public types and functions required by this refactoring.
  • PR #132: Also modifies the same transform dispatch entry point and call sites across CLI, server, and WASM adapters, making equivalent architectural changes.

Poem

🐰 One path instead of two,
No more branches to pursue!
SVG and raster now align,
Unified dispatch—simply divine. ✨
With must_use guards so true,
No forgotten results accrue!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title 'chore: bump deps, add #[must_use], and unify transform dispatch' clearly and concisely summarizes all three main changes in the PR.
Linked Issues check ✅ Passed PR successfully implements all objectives: bumps clap/clap_complete/aws-sdk-s3 (#111, #112, #113), adds #[must_use] to key types/functions (#130), and introduces unified transform() dispatch (#115).
Out of Scope Changes check ✅ Passed All changes directly address the three linked issues. No extraneous modifications detected outside the scope of dependency updates, must_use annotations, and transform dispatch unification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/bump-deps-batch
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@nao1215 nao1215 merged commit c7fd9c3 into main Mar 13, 2026
17 checks passed
@nao1215 nao1215 deleted the chore/bump-deps-batch branch March 13, 2026 03:04
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.

Add #[must_use] to key public types and functions Introduce unified transform dispatch to eliminate SVG/raster routing duplication

1 participant