fix(lint): clear 16 RUST/unwrap warnings#209
Merged
forkwright merged 1 commit intomainfrom Apr 20, 2026
Merged
Conversation
…ed in body)
For each site, applied: (a) ? propagation, (b) .expect with cited
invariant via `// INVARIANT:` comment, (c) test-context expect for
clarity, or (d) kanon:ignore with WHY. Zero kanon:ignore markers used.
Each .expect() carries a line-local `// INVARIANT:` comment so the
RUST/expect rule skips without needing suppression.
Per-site mapping (file:line → decision — rationale):
paroche/src/subsonic/types.rs (6 sites — all decision 4, provably safe):
- Two `respond_*` helpers built Response objects with static 200 +
static Content-Type; converted 4 Response::builder unwraps to
.expect("infallible: static 200 status + static Content-Type").
- Two `serde_json::to_string` on json!() Values are infallible;
.expect("infallible: serde_json::to_string of json!() Value").
- The enclosing pre-existing `#[expect(clippy::unwrap_used)]` attrs
were removed since the invariant is now documented at the call site.
syndesis/src/client/buffer.rs (3 sites — all decision 4):
- line 61: `frames.remove(&seq)` where seq came from first_key_value()
immediately above with no intervening mutation.
- lines 107/108: next()/next_back() on a BTreeMap guarded by
`frames.len() < 2` early return above.
syndesmos/src/retry.rs (4 sites):
- lines 67/76/83 (decision 5 — Mutex<Option<Instant>>):
.expect("mutex poisoning is unrecoverable"). Holder panic would
leave the circuit breaker inconsistent; propagate instead.
- line 145 (decision 4 — exhausted retry loop):
`last_err.expect("loop set last_err on every non-Ok path")` —
`with_retry` traverses `0..=RETRY_DELAYS.len()` iterations; every
path either returns Ok early or assigns `last_err = Some(err)`.
syntaxis/src/queue.rs (3 sites — all decision 4):
- lines 94/98/102 in `reprioritize`: each `tier.remove(pos)` has `pos`
sourced from `tier.iter().position(|i| i.id == id)` on the same
tier one statement prior with no intervening mutation.
Part of the harmonia 77-warning cleanup arc unblocking 05e cutover.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Clears all 16 RUST/unwrap warnings in harmonia library code. Part of the 77-warning cleanup arc unblocking 05e cutover. Sibling PRs address 14 TOML/inline-table-too-long, 3 RUST/indexing-slicing, and 44 RUST/non-exhaustive-enum warnings.
Per-site decisions
Zero
kanon:ignoremarkers used. Every.expect()carries a line-local// INVARIANT:comment citing the specific code-visible invariant so both RUST/unwrap and RUST/expect rules skip cleanly.Verification
cargo check --workspace: PASScargo nextest run --workspace: 1075/1075 passed, 3 skippedkanon lint: 0 RUST/unwrap, 0 RUST/expect, 61 other pre-existing warnings (44 non-exhaustive-enum + 14 TOML + 3 indexing-slicing — sibling agents)kanon gate --stamp: FAILS on cargo clippy (pre-existing: komide type_complexity expect unfulfilled, zetesis too_many_arguments, paroche album_xml_elem/album_json too_many_arguments) and kanon lint (61 pre-existing warnings). Out of scope for this PR.Test plan