Skip to content

chore(profile): sweep pre-existing clippy warnings#3913

Merged
jqnatividad merged 1 commit into
masterfrom
lint-sweep-profile-warnings
May 27, 2026
Merged

chore(profile): sweep pre-existing clippy warnings#3913
jqnatividad merged 1 commit into
masterfrom
lint-sweep-profile-warnings

Conversation

@jqnatividad
Copy link
Copy Markdown
Collaborator

Summary

Nine clippy warnings have been visible in every cargo +nightly clippy -F all_features run since the YAML projection engine landed. None affect behavior, but they crowd the lint output and make new findings harder to spot. This sweep clears all nine in two files (net −9 LOC).

# Warning Fix
1 escape_json_pointer_token never used Deleted the helper and its self-referential test (RFC 6901 escape coverage lives in discovery_merge::tests).
2 ProjectionMode::Catalog never constructed #[allow(dead_code)] on the variant with explanatory doc — orchestrator uses wrap_in_catalog_envelope (post-merge wrap, Roborev #2490 finding #1); only tests construct Catalog directly.
3 collapsible_if in coerce_json_or_string Rust 2024 let-chain collapse: if (...) && let Ok(v) = ....
4 unnecessary_unwrap on profile.validation.external Refactored the trust-gate orchestrator path (introduced in #3911) from is_some() && ... .unwrap() to if let Some(cfg) = ... && !allow_external via let-chain.
5 missing_asserts_for_indexing in is_uuid_like Added assert!(bytes.len() > 23) before the fixed-offset byte index reads. The existing len() == 36 guard already made the access safe; the assert documents the contract and lets the compiler elide bounds checks.
6–9 doc_lazy_continuation ×4 on is_uuid_like Inserted a blank line between the list items and the descriptive paragraph below.

Test plan

  • cargo +nightly clippy --bin qsv -F all_features -- -W clippy::perf exits clean (the only remaining notice is "src/main.rs found in multiple build targets", a harmless Cargo workspace artifact from qsv/qsvmcp sharing main.rs).
  • cargo test --bin qsv -F profile,feature_capable cmd::profile::160 unit tests pass (was 161; the orphan escape_json_pointer_token_matches_rfc6901 test went with its helper).
  • cargo test --test tests -F profile,feature_capable -- test_profile::53 integration tests pass.
  • cargo +nightly fmt applied.
  • python3 scripts/docs-drift-check.py — no drift.
  • All four binaries build clean (qsv, qsvlite, qsvmcp, qsvdp).

Notes

Files don't overlap with the in-flight PR #3912 (DCAT-AP v3 SHACL validator), so these can land in either order.

🤖 Generated with Claude Code

Nine clippy warnings have been visible in every `cargo +nightly
clippy -F all_features` run since the YAML projection engine
landed. None of them affect behavior, but they crowd the lint
output and obscure new issues. This commit clears all nine in
two files:

- `escape_json_pointer_token` was a private helper with no
  non-test callers; the only reference was a self-referential
  test in the same file. Both deleted. RFC 6901 escape coverage
  lives in `discovery_merge::tests::escape_token_handles_rfc6901_round_trip`.
- `ProjectionMode::Catalog` is currently only constructed in
  tests — the orchestrator calls `wrap_in_catalog_envelope`
  after `discovery_merge` for `--catalog` mode (Roborev #2490
  finding #1), bypassing the in-`project` catalog match arm.
  Added `#[allow(dead_code)]` on the variant with an explanatory
  doc-comment so the API surface stays intact and the never-
  constructed lint stops firing in non-test builds.
- `coerce_json_or_string` in projection.rs had a collapsible_if
  pattern flagged by clippy. Collapsed via Rust 2024 let-chain:
  `if (open/close braces) || (open/close brackets) && let Ok(v)
  = serde_json::from_str(...)`. Saves one indentation level.
- The trust-gate orchestrator path in `src/cmd/profile.rs` used
  `is_some() && ... .unwrap()` (introduced in #3911); refactored
  to `if let Some(cfg) = ... && !allow_external` via let-chain.
- `is_uuid_like` gained an explicit `assert!(bytes.len() > 23)`
  before its fixed-offset byte index reads, satisfying the
  repo-enabled `clippy::missing_asserts_for_indexing` lint and
  letting the compiler elide bounds checks. The underlying
  `len() == 36` guard already made the access safe; the assert
  documents that contract.
- Four `doc_lazy_continuation` warnings on `is_uuid_like`'s
  doc comment were fixed by inserting a blank line between the
  list and the descriptive paragraph below it.

`cargo +nightly clippy --bin qsv -F all_features -- -W clippy::perf`
now exits clean except for the harmless "src/main.rs found in
multiple build targets" notice (Cargo workspace artifact from
qsv/qsvmcp sharing main.rs).

All 160 profile unit tests + 53 integration tests pass. Docs
drift check clean. Net change: -9 LOC across 2 files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jqnatividad jqnatividad merged commit 853ad34 into master May 27, 2026
15 of 17 checks passed
@jqnatividad jqnatividad deleted the lint-sweep-profile-warnings branch May 27, 2026 19:18
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