@@ -392,10 +392,10 @@ impl ToMysqlValue for [u8] {
392392
393393impl ToMysqlValue for Vec < u8 > {
394394 fn to_mysql_text < W : Write > ( & self , w : & mut W ) -> io:: Result < ( ) > {
395- ( & self [ ..] ) . to_mysql_text ( w)
395+ ( self [ ..] ) . to_mysql_text ( w)
396396 }
397397 fn to_mysql_bin < W : Write > ( & self , w : & mut W , c : & Column ) -> io:: Result < ( ) > {
398- ( & self [ ..] ) . to_mysql_bin ( w, c)
398+ ( self [ ..] ) . to_mysql_bin ( w, c)
399399 }
400400}
401401
@@ -563,8 +563,10 @@ impl ToMysqlValue for myc::value::Value {
563563 myc:: value:: Value :: Float ( f) => f. to_mysql_text ( w) ,
564564 myc:: value:: Value :: Double ( f) => f. to_mysql_text ( w) ,
565565 myc:: value:: Value :: Date ( y, mo, d, h, mi, s, us) => {
566- NaiveDate :: from_ymd ( i32:: from ( y) , u32:: from ( mo) , u32:: from ( d) )
567- . and_hms_micro ( u32:: from ( h) , u32:: from ( mi) , u32:: from ( s) , us)
566+ NaiveDate :: from_ymd_opt ( i32:: from ( y) , u32:: from ( mo) , u32:: from ( d) )
567+ . unwrap_or_else ( || panic ! ( "invalid date: y {} mo {} d {}" , y, mo, d) )
568+ . and_hms_micro_opt ( u32:: from ( h) , u32:: from ( mi) , u32:: from ( s) , us)
569+ . unwrap_or_else ( || panic ! ( "invalid date: h {} mi {} s {} us {}" , h, mi, s, us) )
568570 . to_mysql_text ( w)
569571 }
570572 myc:: value:: Value :: Time ( neg, d, h, m, s, us) => {
@@ -628,8 +630,10 @@ impl ToMysqlValue for myc::value::Value {
628630 myc:: value:: Value :: Float ( f) => f. to_mysql_bin ( w, c) ,
629631 myc:: value:: Value :: Double ( f) => f. to_mysql_bin ( w, c) ,
630632 myc:: value:: Value :: Date ( y, mo, d, h, mi, s, us) => {
631- NaiveDate :: from_ymd ( i32:: from ( y) , u32:: from ( mo) , u32:: from ( d) )
632- . and_hms_micro ( u32:: from ( h) , u32:: from ( mi) , u32:: from ( s) , us)
633+ NaiveDate :: from_ymd_opt ( i32:: from ( y) , u32:: from ( mo) , u32:: from ( d) )
634+ . unwrap_or_else ( || panic ! ( "invalid date: y {} mo {} d {}" , y, mo, d) )
635+ . and_hms_micro_opt ( u32:: from ( h) , u32:: from ( mi) , u32:: from ( s) , us)
636+ . unwrap_or_else ( || panic ! ( "invalid date: h {} mi {} s {} us {}" , h, mi, s, us) )
633637 . to_mysql_bin ( w, c)
634638 }
635639 myc:: value:: Value :: Time ( neg, d, h, m, s, us) => {
0 commit comments