Document intentional test panics

This commit is contained in:
2026-07-31 03:51:04 +02:00
parent 0287264bbc
commit 5b7c8e0375
+6 -12
View File
@@ -1,3 +1,8 @@
#![expect(
clippy::panic,
reason = "panic paths and panic assertions are intentional test behavior"
)]
use super::*;
use std::alloc::Layout;
use std::cell::Cell;
@@ -16,10 +21,6 @@ impl DropTracker {
}
impl Drop for DropTracker {
#[expect(
clippy::panic,
reason = "overflow means the test's drop-count assertion can no longer be trusted"
)]
fn drop(&mut self) {
let Some(next_count) = self.counter.get().checked_add(1) else {
panic!("drop counter overflow");
@@ -28,10 +29,6 @@ impl Drop for DropTracker {
}
}
#[expect(
clippy::panic,
reason = "overflow means the test's capacity expectation is invalid"
)]
fn checked_product(left: usize, right: usize) -> usize {
let Some(product) = left.checked_mul(right) else {
panic!("test multiplication overflow");
@@ -86,10 +83,7 @@ fn test_debug_implementations_expose_only_metadata() {
assert_debug_metadata(&format!("{send_erased:?}"), "SendTypeErasedVec");
let send_sync_erased = SendSyncTypeErasedVec::new(vec![42_u32]);
assert_debug_metadata(
&format!("{send_sync_erased:?}"),
"SendSyncTypeErasedVec",
);
assert_debug_metadata(&format!("{send_sync_erased:?}"), "SendSyncTypeErasedVec");
}
#[test]