fix(peer): clear remaining clippy warnings

`just clippy` was failing on peer test and helper code after the current lint
set denied warnings. This keeps the cleanup local to the reported warnings and
avoids changing runtime peer behavior or the wire protocol surface.

The test helpers now avoid needless ownership, active-operation assertions take
slices, and the local monitor watch-event helper no longer wraps a value that
cannot fail. The install recovery matrix keeps the same cases, but moves the
case table and per-case assertions into helpers so the test body stays below the
clippy line limit. The remaining lint fixes replace similar temporary names and
use an explicit `expect` message for test-only length conversion.

No separate project documentation update is needed because this only changes
internal test/helper structure and lint-only assertions; the existing peer
architecture docs remain accurate.

Test Plan:
- just fmt
- just clippy
- just test
- git diff --check
- git diff --cached --check

Refs: none
This commit is contained in:
2026-06-13 10:16:48 +02:00
parent 80c50c0db3
commit 0693db94b2
6 changed files with 127 additions and 118 deletions
@@ -225,12 +225,16 @@ mod tests {
assert_eq!(chunk_counts.get(&peers[0]), Some(&2));
assert_eq!(chunk_counts.get(&peers[1]), Some(&2));
let peer_a_bytes = byte_counts.get(&peers[0]).copied().unwrap_or_default();
let peer_b_bytes = byte_counts.get(&peers[1]).copied().unwrap_or_default();
assert_eq!(peer_a_bytes + peer_b_bytes, file_size);
let assigned_bytes = [
byte_counts.get(&peers[0]).copied().unwrap_or_default(),
byte_counts.get(&peers[1]).copied().unwrap_or_default(),
];
assert_eq!(assigned_bytes.iter().sum::<u64>(), file_size);
assert!(
peer_a_bytes.abs_diff(peer_b_bytes) <= CHUNK_SIZE,
"large file bytes should be balanced within one chunk: {peer_a_bytes} vs {peer_b_bytes}"
assigned_bytes[0].abs_diff(assigned_bytes[1]) <= CHUNK_SIZE,
"large file bytes should be balanced within one chunk: {} vs {}",
assigned_bytes[0],
assigned_bytes[1]
);
}