@@ -214,7 +214,8 @@ impl<'r> Decode<'r, Odbc> for NaiveDate {
214214 date_val. year as i32 ,
215215 date_val. month as u32 ,
216216 date_val. day as u32 ,
217- ) . ok_or_else ( || "ODBC: invalid date values" . to_string ( ) ) ?) ;
217+ )
218+ . ok_or_else ( || "ODBC: invalid date values" . to_string ( ) ) ?) ;
218219 }
219220
220221 // Handle text values first (most common for dates)
@@ -269,7 +270,8 @@ impl<'r> Decode<'r, Odbc> for NaiveTime {
269270 time_val. hour as u32 ,
270271 time_val. minute as u32 ,
271272 time_val. second as u32 ,
272- ) . ok_or_else ( || "ODBC: invalid time values" . to_string ( ) ) ?) ;
273+ )
274+ . ok_or_else ( || "ODBC: invalid time values" . to_string ( ) ) ?) ;
273275 }
274276
275277 let mut s = <String as Decode < ' r , Odbc > >:: decode ( value) ?;
@@ -289,17 +291,16 @@ impl<'r> Decode<'r, Odbc> for NaiveDateTime {
289291 if let Some ( ts_val) = value. timestamp ( ) {
290292 // Convert odbc_api::sys::Timestamp to NaiveDateTime
291293 // The ODBC Timestamp structure typically has year, month, day, hour, minute, second fields
292- let date = NaiveDate :: from_ymd_opt (
293- ts_val. year as i32 ,
294- ts_val. month as u32 ,
295- ts_val. day as u32 ,
296- ) . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?;
294+ let date =
295+ NaiveDate :: from_ymd_opt ( ts_val. year as i32 , ts_val. month as u32 , ts_val. day as u32 )
296+ . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?;
297297
298298 let time = NaiveTime :: from_hms_opt (
299299 ts_val. hour as u32 ,
300300 ts_val. minute as u32 ,
301301 ts_val. second as u32 ,
302- ) . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?;
302+ )
303+ . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?;
303304
304305 return Ok ( NaiveDateTime :: new ( date, time) ) ;
305306 }
@@ -331,16 +332,14 @@ impl<'r> Decode<'r, Odbc> for DateTime<Utc> {
331332 // Convert odbc_api::sys::Timestamp to DateTime<Utc>
332333 // The ODBC Timestamp structure typically has year, month, day, hour, minute, second fields
333334 let naive_dt = NaiveDateTime :: new (
334- NaiveDate :: from_ymd_opt (
335- ts_val. year as i32 ,
336- ts_val. month as u32 ,
337- ts_val. day as u32 ,
338- ) . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?,
335+ NaiveDate :: from_ymd_opt ( ts_val. year as i32 , ts_val. month as u32 , ts_val. day as u32 )
336+ . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?,
339337 NaiveTime :: from_hms_opt (
340338 ts_val. hour as u32 ,
341339 ts_val. minute as u32 ,
342340 ts_val. second as u32 ,
343- ) . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?,
341+ )
342+ . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?,
344343 ) ;
345344
346345 return Ok ( DateTime :: < Utc > :: from_naive_utc_and_offset ( naive_dt, Utc ) ) ;
@@ -378,16 +377,14 @@ impl<'r> Decode<'r, Odbc> for DateTime<FixedOffset> {
378377 // Convert odbc_api::sys::Timestamp to DateTime<FixedOffset>
379378 // The ODBC Timestamp structure typically has year, month, day, hour, minute, second fields
380379 let naive_dt = NaiveDateTime :: new (
381- NaiveDate :: from_ymd_opt (
382- ts_val. year as i32 ,
383- ts_val. month as u32 ,
384- ts_val. day as u32 ,
385- ) . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?,
380+ NaiveDate :: from_ymd_opt ( ts_val. year as i32 , ts_val. month as u32 , ts_val. day as u32 )
381+ . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?,
386382 NaiveTime :: from_hms_opt (
387383 ts_val. hour as u32 ,
388384 ts_val. minute as u32 ,
389385 ts_val. second as u32 ,
390- ) . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?,
386+ )
387+ . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?,
391388 ) ;
392389
393390 return Ok ( DateTime :: < Utc > :: from_naive_utc_and_offset ( naive_dt, Utc ) . fixed_offset ( ) ) ;
@@ -429,19 +426,19 @@ impl<'r> Decode<'r, Odbc> for DateTime<Local> {
429426 // Convert odbc_api::sys::Timestamp to DateTime<Local>
430427 // The ODBC Timestamp structure typically has year, month, day, hour, minute, second fields
431428 let naive_dt = NaiveDateTime :: new (
432- NaiveDate :: from_ymd_opt (
433- ts_val. year as i32 ,
434- ts_val. month as u32 ,
435- ts_val. day as u32 ,
436- ) . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?,
429+ NaiveDate :: from_ymd_opt ( ts_val. year as i32 , ts_val. month as u32 , ts_val. day as u32 )
430+ . ok_or_else ( || "ODBC: invalid date values in timestamp" . to_string ( ) ) ?,
437431 NaiveTime :: from_hms_opt (
438432 ts_val. hour as u32 ,
439433 ts_val. minute as u32 ,
440434 ts_val. second as u32 ,
441- ) . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?,
435+ )
436+ . ok_or_else ( || "ODBC: invalid time values in timestamp" . to_string ( ) ) ?,
442437 ) ;
443438
444- return Ok ( DateTime :: < Utc > :: from_naive_utc_and_offset ( naive_dt, Utc ) . with_timezone ( & Local ) ) ;
439+ return Ok (
440+ DateTime :: < Utc > :: from_naive_utc_and_offset ( naive_dt, Utc ) . with_timezone ( & Local )
441+ ) ;
445442 }
446443
447444 let mut s = <String as Decode < ' r , Odbc > >:: decode ( value) ?;
0 commit comments