@@ -41,20 +41,12 @@ impl Date {
4141 assert ! ( ( MIN_YEAR ..=MAX_YEAR ) . contains( & year) , "year out of range" ) ;
4242 assert ! ( ( MIN_MONTH ..=MAX_MONTH ) . contains( & month) , "month out of range" ) ;
4343 assert ! ( ( MIN_DAY ..=MAX_DAY ) . contains( & day) , "day out of range" ) ;
44- Self {
45- year,
46- month,
47- day,
48- }
44+ Self { year, month, day }
4945 }
5046
5147 pub ( crate ) fn decode ( dos_date : u16 ) -> Self {
5248 let ( year, month, day) = ( ( dos_date >> 9 ) + MIN_YEAR , ( dos_date >> 5 ) & 0xF , dos_date & 0x1F ) ;
53- Self {
54- year,
55- month,
56- day,
57- }
49+ Self { year, month, day }
5850 }
5951
6052 pub ( crate ) fn encode ( self ) -> u16 {
@@ -95,25 +87,15 @@ impl Time {
9587 assert ! ( min <= 59 , "min out of range" ) ;
9688 assert ! ( sec <= 59 , "sec out of range" ) ;
9789 assert ! ( millis <= 999 , "millis out of range" ) ;
98- Self {
99- hour,
100- min,
101- sec,
102- millis,
103- }
90+ Self { hour, min, sec, millis }
10491 }
10592
10693 pub ( crate ) fn decode ( dos_time : u16 , dos_time_hi_res : u8 ) -> Self {
10794 let hour = dos_time >> 11 ;
10895 let min = ( dos_time >> 5 ) & 0x3F ;
10996 let sec = ( dos_time & 0x1F ) * 2 + u16:: from ( dos_time_hi_res / 100 ) ;
11097 let millis = u16:: from ( dos_time_hi_res % 100 ) * 10 ;
111- Self {
112- hour,
113- min,
114- sec,
115- millis,
116- }
98+ Self { hour, min, sec, millis }
11799 }
118100
119101 pub ( crate ) fn encode ( self ) -> ( u16 , u8 ) {
0 commit comments