···5959#[test]
6060fn rust_advisories_ignore_deadlines() {
6161 let today = time::OffsetDateTime::now_utc().date();
6262- let regex = regex::Regex::new(r"(?m)^FIX-DEADLINE:\s*(\d{4})-(\d{2})-(\d{2})$").unwrap();
6262+ let regex = regex::Regex::new(r"(?m)FIX-DEADLINE: (\d{4})-(\d{2})-(\d{2})").unwrap();
63636464 for ignored in load_cargo_deny_config().advisories.ignore {
6565 let id = ignored.id;
6666- let Some(deadline) = regex.captures(&ignored.reason).and_then(|caps| {
6767- let year = caps[1].parse::<i32>().ok()?;
6868- let month = caps[2].parse::<u8>().ok()?;
6969- let day = caps[3].parse::<u8>().ok()?;
7070- time::Date::from_calendar_date(year, month.try_into().ok()?, day).ok()
7171- }) else {
6666+ let reason = ignored.reason;
6767+ let Some(captures) = regex.captures(&reason) else {
7268 panic!(
7369 "
7470deny.toml advisory missing deadline!
7571Add a line to the `reason` property for {id} with this format:
76727773 FIX-DEADLINE: 2026-01-05
7474+7575+{reason:?}
7876"
7977 )
8078 };
7979+8080+ let year = captures[1].parse::<i32>().expect("parse year");
8181+ let month = captures[2].parse::<u8>().expect("parse month int");
8282+ let month = month.try_into().expect("parse month");
8383+ let day = captures[3].parse::<u8>().expect("parse day");
8484+ let deadline = time::Date::from_calendar_date(year, month, day).expect("construct date");
81858286 assert!(
8387 today <= deadline,