Skip to content

Commit d286d0a

Browse files
committed
Remove old workarounds
1 parent 5b88906 commit d286d0a

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

src/types/mod.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,7 @@ pub trait ToSql: fmt::Debug {
826826
}
827827

828828
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!();
837830

838831
fn to_sql<W: Write + ?Sized>(&self, ty: &Type, out: &mut W, ctx: &SessionInfo) -> Result<IsNull> {
839832
(*self).to_sql(ty, out, ctx)
@@ -871,14 +864,7 @@ impl ToSql for bool {
871864
}
872865

873866
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!();
882868

883869
fn to_sql<W: Write+?Sized>(&self, _: &Type, w: &mut W, _: &SessionInfo)
884870
-> Result<IsNull> {
@@ -903,14 +889,7 @@ impl ToSql for Vec<u8> {
903889
}
904890

905891
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!();
914893

915894
fn to_sql<W: Write+?Sized>(&self, _: &Type, w: &mut W, _: &SessionInfo)
916895
-> Result<IsNull> {

0 commit comments

Comments
 (0)