@@ -826,14 +826,7 @@ pub trait ToSql: fmt::Debug {
826
826
}
827
827
828
828
impl < ' a , T > ToSql for & ' a T where T : ToSql {
829
- fn to_sql_checked ( & self , ty : & Type , out : & mut Write , ctx : & SessionInfo )
830
- -> Result < IsNull > {
831
- if !<& ' a T as ToSql >:: accepts ( ty) {
832
- return Err ( Error :: WrongType ( ty. clone ( ) ) ) ;
833
- }
834
- self . to_sql ( ty, out, ctx)
835
- }
836
-
829
+ to_sql_checked ! ( ) ;
837
830
838
831
fn to_sql < W : Write + ?Sized > ( & self , ty : & Type , out : & mut W , ctx : & SessionInfo ) -> Result < IsNull > {
839
832
( * self ) . to_sql ( ty, out, ctx)
@@ -871,14 +864,7 @@ impl ToSql for bool {
871
864
}
872
865
873
866
impl < ' a > ToSql for & ' a [ u8 ] {
874
- // FIXME should use to_sql_checked!() but blocked on rust-lang/rust#24308
875
- fn to_sql_checked ( & self , ty : & Type , out : & mut Write , ctx : & SessionInfo )
876
- -> Result < IsNull > {
877
- if !<& ' a [ u8 ] as ToSql >:: accepts ( ty) {
878
- return Err ( Error :: WrongType ( ty. clone ( ) ) ) ;
879
- }
880
- self . to_sql ( ty, out, ctx)
881
- }
867
+ to_sql_checked ! ( ) ;
882
868
883
869
fn to_sql < W : Write +?Sized > ( & self , _: & Type , w : & mut W , _: & SessionInfo )
884
870
-> Result < IsNull > {
@@ -903,14 +889,7 @@ impl ToSql for Vec<u8> {
903
889
}
904
890
905
891
impl < ' a > ToSql for & ' a str {
906
- // FIXME should use to_sql_checked!() but blocked on rust-lang/rust#24308
907
- fn to_sql_checked ( & self , ty : & Type , out : & mut Write , ctx : & SessionInfo )
908
- -> Result < IsNull > {
909
- if !<& ' a str as ToSql >:: accepts ( ty) {
910
- return Err ( Error :: WrongType ( ty. clone ( ) ) ) ;
911
- }
912
- self . to_sql ( ty, out, ctx)
913
- }
892
+ to_sql_checked ! ( ) ;
914
893
915
894
fn to_sql < W : Write +?Sized > ( & self , _: & Type , w : & mut W , _: & SessionInfo )
916
895
-> Result < IsNull > {
0 commit comments