#![allow(dead_code)]
use antigen::{antigen, antigen_tolerance, presents};
#[antigen(
name = "intentional-panic-antigen",
family = "boundary-violation",
fingerprint = r#"name = matches("IntentionalPanicSite")"#,
summary = "Marks code that panics deliberately (assertion-style invariants in test scaffolding)."
)]
pub struct IntentionalPanicAntigen;
pub struct IntentionalPanicSite;
#[presents(IntentionalPanicAntigen)]
#[antigen_tolerance(
IntentionalPanicAntigen,
rationale = "Test scaffolding only — production callers go through a different code path \
that returns Result<T, E> rather than panicking. Verified by integration tests.",
until = "v0.2",
see = [
"https://github.com/antigen-rs/antigen/blob/main/docs/decisions.md#adr-011",
]
)]
impl IntentionalPanicSite {
#[allow(
clippy::manual_assert,
reason = "panic! literal required for fingerprint match"
)]
pub fn assert_invariant(condition: bool) {
if !condition {
panic!("invariant violated — this is intentional in test scaffolding");
}
}
}
fn main() {
println!("antigen_tolerance example: intentional opt-out with rationale on the page.");
println!();
println!("Run `cargo run --bin cargo-antigen -- antigen scan --root antigen/examples`");
println!("to see the tolerated site reported separately from unaddressed presentations.");
}