Remove another old workaround

This commit is contained in:
Steven Fackler 2015-12-05 18:37:05 -08:00
parent 2504aa504a
commit 4f0a5fa255

View File

@ -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<IsNull> {
if !<Slice<'a, T> as ToSql>::accepts(ty) {
return Err(Error::WrongType(ty.clone()));
}
self.to_sql(ty, out, ctx)
}
fn to_sql<W: Write + ?Sized>(&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!();
}