chore(profile): sweep pre-existing clippy warnings#3913
Merged
Conversation
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>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Nine clippy warnings have been visible in every
cargo +nightly clippy -F all_featuresrun 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).escape_json_pointer_tokennever useddiscovery_merge::tests).ProjectionMode::Catalognever constructed#[allow(dead_code)]on the variant with explanatory doc — orchestrator useswrap_in_catalog_envelope(post-merge wrap, Roborev #2490 finding #1); only tests constructCatalogdirectly.collapsible_ifincoerce_json_or_stringif (...) && let Ok(v) = ....unnecessary_unwraponprofile.validation.externalis_some() && ... .unwrap()toif let Some(cfg) = ... && !allow_externalvia let-chain.missing_asserts_for_indexinginis_uuid_likeassert!(bytes.len() > 23)before the fixed-offset byte index reads. The existinglen() == 36guard already made the access safe; the assert documents the contract and lets the compiler elide bounds checks.doc_lazy_continuation×4 onis_uuid_likeTest plan
cargo +nightly clippy --bin qsv -F all_features -- -W clippy::perfexits 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 orphanescape_json_pointer_token_matches_rfc6901test went with its helper).cargo test --test tests -F profile,feature_capable -- test_profile::— 53 integration tests pass.cargo +nightly fmtapplied.python3 scripts/docs-drift-check.py— no drift.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