@@ -99,18 +99,18 @@ impl Error for DayFromStrError {}
9999
100100impl 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) .
109109pub 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) .
114114pub 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