From 4f0a5fa2557f93aa8156c48aa5a420b7062c3cae Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 5 Dec 2015 18:37:05 -0800 Subject: [PATCH] Remove another old workaround --- src/types/slice.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/types/slice.rs b/src/types/slice.rs index 789d3365..2feb62dc 100644 --- a/src/types/slice.rs +++ b/src/types/slice.rs @@ -2,7 +2,6 @@ use std::io::prelude::*; use byteorder::{WriteBytesExt, BigEndian}; use Result; -use error::Error; use types::{Type, ToSql, Kind, IsNull, SessionInfo, downcast}; /// An adapter type mapping slices to Postgres arrays. @@ -30,14 +29,6 @@ use types::{Type, ToSql, Kind, IsNull, SessionInfo, downcast}; pub struct Slice<'a, T: 'a + ToSql>(pub &'a [T]); impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> { - // FIXME should use to_sql_checked!() but blocked on rust-lang/rust#24308 - fn to_sql_checked(&self, ty: &Type, out: &mut Write, ctx: &SessionInfo) -> Result { - if ! as ToSql>::accepts(ty) { - return Err(Error::WrongType(ty.clone())); - } - self.to_sql(ty, out, ctx) - } - fn to_sql(&self, ty: &Type, mut w: &mut W, @@ -76,4 +67,6 @@ impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> { _ => false, } } + + to_sql_checked!(); }