Skip to content

Commit a64956d

Browse files
committed
Fixup error message
1 parent 0e01d76 commit a64956d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/template/day.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,18 @@ impl Error for DayFromStrError {}
9999

100100
impl Display for DayFromStrError {
101101
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
102-
f.write_str("expecting a day number between 1 and 12")
102+
f.write_str(&format!("expecting a day number between 1 and {}", day_count!()))
103103
}
104104
}
105105

106106
/* -------------------------------------------------------------------------- */
107107

108-
/// An iterator that yields every day of advent from the 1st to the 12th.
108+
/// An iterator that yields every day of advent from the 1st to the 12th (or 25th before 2025).
109109
pub fn all_days() -> AllDays {
110110
AllDays::new()
111111
}
112112

113-
/// An iterator that yields every day of advent from the 1st to the 12th.
113+
/// An iterator that yields every day of advent from the 1st to the 12th (or 25th before 2025).
114114
pub struct AllDays {
115115
current: u8,
116116
}
@@ -129,7 +129,7 @@ impl Iterator for AllDays {
129129
if self.current > day_count!() {
130130
return None;
131131
}
132-
// NOTE: the iterator starts at 1 and we have verified that the value is not above 12.
132+
// NOTE: the iterator starts at 1, and we have verified that the value is not above 12 (or 25).
133133
let day = Day(self.current);
134134
self.current += 1;
135135

@@ -145,7 +145,7 @@ macro_rules! day {
145145
($day:expr) => {
146146
const {
147147
$crate::template::Day::new($day)
148-
.expect("invalid day number, expecting a value between 1 and 12")
148+
.expect(&format!("invalid day number, expecting a value between 1 and {}", day_count!()))
149149
}
150150
};
151151
}

0 commit comments

Comments
 (0)