Skip to content

Commit 0d81cf3

Browse files
fix(automation): satisfy clippy in job_webhook reset tests (#261)
The webhook-reset fix (#259) landed test code that trips the workspace clippy denials: an unwrap_used in the reset-after-response test and a map_unwrap_or in the drain loop. Every PR's Clippy job now fails on master's code. Replace the unwrap with an explicit match/panic and the map/unwrap_or with is_ok_and. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 604115c commit 0d81cf3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/automation/job_webhook.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,11 @@ mod tests {
382382
};
383383
// The trailing `\r\n\r\n` never arrives before the reset, so the loop
384384
// hits the read error — but a full status line was already received.
385-
assert_eq!(read_status(&mut reader).unwrap(), 202);
385+
let status = match read_status(&mut reader) {
386+
Ok(status) => status,
387+
Err(err) => panic!("read_status should succeed: {err}"),
388+
};
389+
assert_eq!(status, 202);
386390
}
387391

388392
#[test]
@@ -447,7 +451,7 @@ mod tests {
447451
// 10053), aborting the client mid-read.
448452
let _ = stream.shutdown(std::net::Shutdown::Write);
449453
let mut drain = [0_u8; 64];
450-
while stream.read(&mut drain).map(|n| n > 0).unwrap_or(false) {}
454+
while stream.read(&mut drain).is_ok_and(|n| n > 0) {}
451455
});
452456

453457
let url = Url::parse("http://webhook.example.test/hook?token=abc")?;

0 commit comments

Comments
 (0)