@@ -7,8 +7,8 @@ use num_traits::FromPrimitive;
77impl TryFrom < crate :: Date > for chrono:: NaiveDate {
88 type Error = ( ) ;
99
10- fn try_from ( iso : crate :: Date ) -> Result < Self , Self :: Error > {
11- let maybe = match iso {
10+ fn try_from ( d : crate :: Date ) -> Result < Self , Self :: Error > {
11+ let maybe = match d {
1212 crate :: Date :: YMD { year, month, day } => {
1313 chrono:: NaiveDate :: from_ymd_opt ( year, month, day)
1414 }
@@ -37,37 +37,37 @@ mod test_date {
3737
3838 #[ test]
3939 fn naivedate_from_ymd ( ) {
40- let iso = crate :: Date :: YMD {
40+ let d = crate :: Date :: YMD {
4141 year : 2023 ,
4242 month : 2 ,
4343 day : 8 ,
4444 } ;
45- let naive = chrono:: NaiveDate :: try_from ( iso ) . unwrap ( ) ;
45+ let naive = chrono:: NaiveDate :: try_from ( d ) . unwrap ( ) ;
4646 assert_eq ! ( naive. year( ) , 2023 ) ;
4747 assert_eq ! ( naive. month( ) , 2 ) ;
4848 assert_eq ! ( naive. day( ) , 8 ) ;
4949 }
5050
5151 #[ test]
5252 fn naivedate_from_ywd ( ) {
53- let iso = Date :: Week {
53+ let d = Date :: Week {
5454 year : 2023 ,
5555 week : 6 ,
5656 day : 2 ,
5757 } ;
58- let naive = chrono:: NaiveDate :: try_from ( iso ) . unwrap ( ) ;
58+ let naive = chrono:: NaiveDate :: try_from ( d ) . unwrap ( ) ;
5959 assert_eq ! ( naive. year( ) , 2023 ) ;
6060 assert_eq ! ( naive. month( ) , 2 ) ;
6161 assert_eq ! ( naive. day( ) , 8 ) ;
6262 }
6363
6464 #[ test]
6565 fn naivedate_from_ordinal ( ) {
66- let iso = crate :: Date :: Ordinal {
66+ let d = crate :: Date :: Ordinal {
6767 year : 2023 ,
6868 day : 39 ,
6969 } ;
70- let naive = chrono:: NaiveDate :: try_from ( iso ) . unwrap ( ) ;
70+ let naive = chrono:: NaiveDate :: try_from ( d ) . unwrap ( ) ;
7171 assert_eq ! ( naive. year( ) , 2023 ) ;
7272 assert_eq ! ( naive. month( ) , 2 ) ;
7373 assert_eq ! ( naive. day( ) , 8 ) ;
@@ -76,8 +76,8 @@ mod test_date {
7676
7777impl TryFrom < crate :: Time > for chrono:: NaiveTime {
7878 type Error = ( ) ;
79- fn try_from ( iso : crate :: Time ) -> Result < Self , Self :: Error > {
80- chrono:: NaiveTime :: from_hms_opt ( iso . hour , iso . minute , iso . second ) . ok_or ( ( ) )
79+ fn try_from ( t : crate :: Time ) -> Result < Self , Self :: Error > {
80+ chrono:: NaiveTime :: from_hms_opt ( t . hour , t . minute , t . second ) . ok_or ( ( ) )
8181 }
8282}
8383
@@ -91,17 +91,17 @@ impl crate::Time {
9191impl TryFrom < crate :: DateTime > for chrono:: DateTime < chrono:: FixedOffset > {
9292 type Error = ( ) ;
9393
94- fn try_from ( iso : crate :: DateTime ) -> Result < Self , Self :: Error > {
95- let offset = iso . time . offset . unwrap_or ( crate :: Offset {
94+ fn try_from ( dt : crate :: DateTime ) -> Result < Self , Self :: Error > {
95+ let offset = dt . time . offset . unwrap_or ( crate :: Offset {
9696 offset_hours : 0 ,
9797 offset_minutes : 0 ,
9898 } ) ;
9999
100100 let offset_minutes = offset. offset_hours * 3600 + offset. offset_minutes ;
101101 let offset = chrono:: FixedOffset :: east_opt ( offset_minutes) . ok_or ( ( ) ) ?;
102102
103- let naive_time = chrono:: NaiveTime :: try_from ( iso . time ) ?;
104- let naive_date_time = chrono:: NaiveDate :: try_from ( iso . date ) ?. and_time ( naive_time) ;
103+ let naive_time = chrono:: NaiveTime :: try_from ( dt . time ) ?;
104+ let naive_date_time = chrono:: NaiveDate :: try_from ( dt . date ) ?. and_time ( naive_time) ;
105105
106106 offset
107107 . from_local_datetime ( & naive_date_time)
@@ -129,7 +129,7 @@ mod test_datetime {
129129
130130 #[ test]
131131 fn datetime_from_iso_ymd_offset ( ) {
132- let iso = crate :: DateTime {
132+ let dt = crate :: DateTime {
133133 date : crate :: Date :: YMD {
134134 year : 2023 ,
135135 month : 2 ,
@@ -146,7 +146,7 @@ mod test_datetime {
146146 } ) ,
147147 } ,
148148 } ;
149- let datetime = chrono:: DateTime :: try_from ( iso ) . unwrap ( ) ;
149+ let datetime = chrono:: DateTime :: try_from ( dt ) . unwrap ( ) ;
150150
151151 assert_eq ! ( datetime. year( ) , 2023 ) ;
152152 assert_eq ! ( datetime. month( ) , 2 ) ;
@@ -159,7 +159,7 @@ mod test_datetime {
159159
160160 #[ test]
161161 fn datetime_from_iso_ymd_utc ( ) {
162- let iso = crate :: DateTime {
162+ let dt = crate :: DateTime {
163163 date : crate :: Date :: YMD {
164164 year : 2023 ,
165165 month : 2 ,
@@ -176,7 +176,7 @@ mod test_datetime {
176176 } ) ,
177177 } ,
178178 } ;
179- let datetime = chrono:: DateTime :: try_from ( iso ) . unwrap ( ) ;
179+ let datetime = chrono:: DateTime :: try_from ( dt ) . unwrap ( ) ;
180180
181181 assert_eq ! ( datetime. year( ) , 2023 ) ;
182182 assert_eq ! ( datetime. month( ) , 2 ) ;
@@ -189,7 +189,7 @@ mod test_datetime {
189189
190190 #[ test]
191191 fn datetime_from_iso_ymd_no_offset ( ) {
192- let iso = crate :: DateTime {
192+ let dt = crate :: DateTime {
193193 date : crate :: Date :: YMD {
194194 year : 2023 ,
195195 month : 2 ,
@@ -206,7 +206,7 @@ mod test_datetime {
206206 } ) ,
207207 } ,
208208 } ;
209- let datetime = chrono:: DateTime :: try_from ( iso ) . unwrap ( ) ;
209+ let datetime = chrono:: DateTime :: try_from ( dt ) . unwrap ( ) ;
210210
211211 assert_eq ! ( datetime. year( ) , 2023 ) ;
212212 assert_eq ! ( datetime. month( ) , 2 ) ;
@@ -219,7 +219,7 @@ mod test_datetime {
219219
220220 #[ test]
221221 fn datetime_from_iso_ywd ( ) {
222- let iso = crate :: DateTime {
222+ let dt = crate :: DateTime {
223223 date : crate :: Date :: Week {
224224 year : 2023 ,
225225 week : 6 ,
@@ -236,7 +236,7 @@ mod test_datetime {
236236 } ) ,
237237 } ,
238238 } ;
239- let datetime = chrono:: DateTime :: try_from ( iso ) . unwrap ( ) ;
239+ let datetime = chrono:: DateTime :: try_from ( dt ) . unwrap ( ) ;
240240
241241 assert_eq ! ( datetime. year( ) , 2023 ) ;
242242 assert_eq ! ( datetime. month( ) , 2 ) ;
0 commit comments