@@ -220,8 +220,7 @@ pub trait FromSql {
220220 /// Creates a new value of this type from a buffer of Postgres data.
221221 ///
222222 /// If the value was `NULL`, the buffer will be `None`.
223- fn from_sql ( ty : & PostgresType , raw : & Option < Vec < u8 > > )
224- -> PostgresResult < Self > ;
223+ fn from_sql ( ty : & PostgresType , raw : & Option < Vec < u8 > > ) -> PostgresResult < Self > ;
225224}
226225
227226#[ doc( hidden) ]
@@ -282,8 +281,7 @@ impl RawFromSql for Timespec {
282281macro_rules! from_range_impl(
283282 ( $t: ty) => (
284283 impl RawFromSql for Range <$t> {
285- fn raw_from_sql<R : Reader >( rdr: & mut R )
286- -> PostgresResult <Range <$t>> {
284+ fn raw_from_sql<R : Reader >( rdr: & mut R ) -> PostgresResult <Range <$t>> {
287285 let t = try_pg!( rdr. read_i8( ) ) ;
288286
289287 if t & RANGE_EMPTY != 0 {
@@ -444,8 +442,7 @@ impl FromSql for Option<HashMap<String, Option<String>>> {
444442 fn from_sql ( ty : & PostgresType , raw : & Option < Vec < u8 > > )
445443 -> PostgresResult < Option < HashMap < String , Option < String > > > > {
446444 match * ty {
447- PgUnknownType { name : ref name, .. }
448- if "hstore" == name. as_slice ( ) => { }
445+ PgUnknownType { name : ref name, .. } if "hstore" == name. as_slice ( ) => { }
449446 _ => return Err ( PgWrongType ( ty. clone ( ) ) )
450447 }
451448
@@ -548,31 +545,27 @@ raw_to_impl!(f64, write_be_f64)
548545
549546impl RawToSql for Timespec {
550547 fn raw_to_sql < W : Writer > ( & self , w : & mut W ) -> PostgresResult < ( ) > {
551- let t = ( self . sec - TIME_SEC_CONVERSION ) * USEC_PER_SEC
552- + self . nsec as i64 / NSEC_PER_USEC ;
548+ let t = ( self . sec - TIME_SEC_CONVERSION ) * USEC_PER_SEC + self . nsec as i64 / NSEC_PER_USEC ;
553549 Ok ( try_pg ! ( w. write_be_i64( t) ) )
554550 }
555551}
556552
557553macro_rules! to_range_impl(
558554 ( $t: ty) => (
559555 impl RawToSql for Range <$t> {
560- fn raw_to_sql<W : Writer >( & self , buf: & mut W )
561- -> PostgresResult <( ) > {
556+ fn raw_to_sql<W : Writer >( & self , buf: & mut W ) -> PostgresResult <( ) > {
562557 let mut tag = 0 ;
563558 if self . is_empty( ) {
564559 tag |= RANGE_EMPTY ;
565560 } else {
566561 match self . lower( ) {
567562 None => tag |= RANGE_LOWER_UNBOUNDED ,
568- Some ( & RangeBound { type_: Inclusive , .. } ) =>
569- tag |= RANGE_LOWER_INCLUSIVE ,
563+ Some ( & RangeBound { type_: Inclusive , .. } ) => tag |= RANGE_LOWER_INCLUSIVE ,
570564 _ => { }
571565 }
572566 match self . upper( ) {
573567 None => tag |= RANGE_UPPER_UNBOUNDED ,
574- Some ( & RangeBound { type_: Inclusive , .. } ) =>
575- tag |= RANGE_UPPER_INCLUSIVE ,
568+ Some ( & RangeBound { type_: Inclusive , .. } ) => tag |= RANGE_UPPER_INCLUSIVE ,
576569 _ => { }
577570 }
578571 }
@@ -619,8 +612,7 @@ impl RawToSql for Json {
619612macro_rules! to_option_impl(
620613 ( $( $oid: pat) |+, $t: ty) => (
621614 impl ToSql for Option <$t> {
622- fn to_sql( & self , ty: & PostgresType )
623- -> PostgresResult <( Format , Option <Vec <u8 >>) > {
615+ fn to_sql( & self , ty: & PostgresType ) -> PostgresResult <( Format , Option <Vec <u8 >>) > {
624616 check_types!( $( $oid) |+, ty)
625617
626618 match * self {
@@ -635,8 +627,7 @@ macro_rules! to_option_impl(
635627macro_rules! to_option_impl_lifetime(
636628 ( $( $oid: pat) |+, $t: ty) => (
637629 impl <' a> ToSql for Option <$t> {
638- fn to_sql( & self , ty: & PostgresType )
639- -> PostgresResult <( Format , Option <Vec <u8 >>) > {
630+ fn to_sql( & self , ty: & PostgresType ) -> PostgresResult <( Format , Option <Vec <u8 >>) > {
640631 check_types!( $( $oid) |+, ty)
641632
642633 match * self {
@@ -651,8 +642,7 @@ macro_rules! to_option_impl_lifetime(
651642macro_rules! to_raw_to_impl(
652643 ( $( $oid: ident) |+, $t: ty) => (
653644 impl ToSql for $t {
654- fn to_sql( & self , ty: & PostgresType )
655- -> PostgresResult <( Format , Option <Vec <u8 >>) > {
645+ fn to_sql( & self , ty: & PostgresType ) -> PostgresResult <( Format , Option <Vec <u8 >>) > {
656646 check_types!( $( $oid) |+, ty)
657647
658648 let mut writer = MemWriter :: new( ) ;
@@ -680,8 +670,7 @@ to_raw_to_impl!(PgInt8Range, Range<i64>)
680670to_raw_to_impl ! ( PgTsRange | PgTstzRange , Range <Timespec >)
681671
682672impl < ' a > ToSql for & ' a str {
683- fn to_sql ( & self , ty : & PostgresType )
684- -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
673+ fn to_sql ( & self , ty : & PostgresType ) -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
685674 check_types ! ( PgVarchar | PgText | PgCharN | PgName , ty)
686675 Ok ( ( Text , Some ( Vec :: from_slice ( self . as_bytes ( ) ) ) ) )
687676 }
@@ -690,8 +679,7 @@ impl<'a> ToSql for &'a str {
690679to_option_impl_lifetime ! ( PgVarchar | PgText | PgCharN | PgName , & ' a str )
691680
692681impl < ' a > ToSql for & ' a [ u8 ] {
693- fn to_sql ( & self , ty : & PostgresType )
694- -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
682+ fn to_sql ( & self , ty : & PostgresType ) -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
695683 check_types ! ( PgByteA , ty)
696684 Ok ( ( Binary , Some ( Vec :: from_slice ( * self ) ) ) )
697685 }
@@ -704,8 +692,7 @@ to_raw_to_impl!(PgTimestamp | PgTimestampTZ, Timespec)
704692macro_rules! to_array_impl(
705693 ( $( $oid: ident) |+, $t: ty) => (
706694 impl ToSql for ArrayBase <Option <$t>> {
707- fn to_sql( & self , ty: & PostgresType )
708- -> PostgresResult <( Format , Option <Vec <u8 >>) > {
695+ fn to_sql( & self , ty: & PostgresType ) -> PostgresResult <( Format , Option <Vec <u8 >>) > {
709696 check_types!( $( $oid) |+, ty)
710697 let mut buf = MemWriter :: new( ) ;
711698
@@ -755,11 +742,9 @@ to_array_impl!(PgInt8RangeArray, Range<i64>)
755742to_array_impl ! ( PgJsonArray , Json )
756743
757744impl ToSql for HashMap < String , Option < String > > {
758- fn to_sql ( & self , ty : & PostgresType )
759- -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
745+ fn to_sql ( & self , ty : & PostgresType ) -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
760746 match * ty {
761- PgUnknownType { name : ref name, .. }
762- if "hstore" == name. as_slice ( ) => { }
747+ PgUnknownType { name : ref name, .. } if "hstore" == name. as_slice ( ) => { }
763748 _ => return Err ( PgWrongType ( ty. clone ( ) ) )
764749 }
765750
@@ -785,11 +770,9 @@ impl ToSql for HashMap<String, Option<String>> {
785770}
786771
787772impl ToSql for Option < HashMap < String , Option < String > > > {
788- fn to_sql ( & self , ty : & PostgresType )
789- -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
773+ fn to_sql ( & self , ty : & PostgresType ) -> PostgresResult < ( Format , Option < Vec < u8 > > ) > {
790774 match * ty {
791- PgUnknownType { name : ref name, .. }
792- if "hstore" == name. as_slice ( ) => { }
775+ PgUnknownType { name : ref name, .. } if "hstore" == name. as_slice ( ) => { }
793776 _ => return Err ( PgWrongType ( ty. clone ( ) ) )
794777 }
795778
0 commit comments