Skip to content

refactor(ar,ar2): group params in private helpers + document too_many_arguments allows (#83)#228

Merged
kalwalt merged 1 commit into
devfrom
refactor/too-many-args-83
Jul 15, 2026
Merged

refactor(ar,ar2): group params in private helpers + document too_many_arguments allows (#83)#228
kalwalt merged 1 commit into
devfrom
refactor/too-many-args-83

Conversation

@kalwalt

@kalwalt kalwalt commented Jul 15, 2026

Copy link
Copy Markdown
Member

First increment of the clippy::too_many_arguments cleanup (#83). Includes a full audit doc: docs/design/issue-83-too-many-args-audit.md.

What this does

Refactor the three private, non-SIMD helpers into param structs (destructured at the top so bodies are untouched), removing their #[allow]:

  • ar/matrix.rssample_gridGridSample
  • ar2/feature_map.rsmake_templateTemplatePatch, select_featuresFeatureSelection

Document the remaining ar/ar2 allows with a // rationale: comment instead of refactoring:

  • Public C-faithful API (ar_labeling, ar_detect_marker2, ar_get_marker_info, ar_patt_save/get_image/get_image2, ar2_tracking_2d_sub, ar2_get_best_matching[_sub_fine]) — grouping into structs is a breaking change, deferred to a deliberate pre-1.0 API pass.
  • SIMD runtime-dispatch (get_similarity + _scalar) — signatures locked to the SIMD variants for is_x86_feature_detected! dispatch (per CLAUDE.md §7.4).

kpm/freak allows are left for a follow-up increment (see the audit doc's plan).

Verification

  • cargo test — matrix + feature_map suites green (incl. make_template/select_features paths)
  • cargo fmt --check clean; strict clippy --all-targets --all-features -D warnings clean
  • Examples run correctly: simple (pattern) → marker CF 0.89, pose OK; simple_nft (kpm) → ✓ KPM match, error 5.09

Part of the Stabilization & DX milestone.

🤖 Generated with Claude Code

)

First increment of the too_many_arguments cleanup. Refactor the three
private, non-SIMD helpers to take a param struct (destructured at the top
so bodies are unchanged), removing their #[allow]:

- ar/matrix.rs: sample_grid -> GridSample
- ar2/feature_map.rs: make_template -> TemplatePatch, select_features ->
  FeatureSelection

For the remaining ar/ar2 allows, add a `// rationale:` comment instead of
refactoring:
- public C-faithful API (ar_labeling, ar_detect_marker2, ar_get_marker_info,
  ar_patt_save/get_image/get_image2, ar2_tracking_2d_sub,
  ar2_get_best_matching[_sub_fine]) — struct-grouping would be a breaking
  change, deferred to a pre-1.0 API pass.
- SIMD runtime-dispatch (get_similarity + _scalar) — signatures locked to
  the SIMD variants for is_x86_feature_detected! dispatch.

kpm/freak allows are left for a follow-up increment. Full audit +
incremental plan in docs/design/issue-83-too-many-args-audit.md.

Verified: cargo test (matrix + feature_map green), strict clippy clean,
and the simple (pattern) + simple_nft (kpm) examples run correctly
(marker CF 0.89 / KPM match error 5.09).

Refs #83

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/core/src/ar2/feature_map.rs 66.66% 15 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kalwalt kalwalt self-assigned this Jul 15, 2026
@kalwalt kalwalt added this to the Stabilization & DX milestone Jul 15, 2026
@kalwalt
kalwalt merged commit b450c06 into dev Jul 15, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Plan to port KPM to rust Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant