Skip to content

Commit 4f0a5fa

Browse files
committed
Remove another old workaround
1 parent 2504aa5 commit 4f0a5fa

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/types/slice.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::io::prelude::*;
22
use byteorder::{WriteBytesExt, BigEndian};
33

44
use Result;
5-
use error::Error;
65
use types::{Type, ToSql, Kind, IsNull, SessionInfo, downcast};
76

87
/// An adapter type mapping slices to Postgres arrays.
@@ -30,14 +29,6 @@ use types::{Type, ToSql, Kind, IsNull, SessionInfo, downcast};
3029
pub struct Slice<'a, T: 'a + ToSql>(pub &'a [T]);
3130

3231
impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
33-
// FIXME should use to_sql_checked!() but blocked on rust-lang/rust#24308
34-
fn to_sql_checked(&self, ty: &Type, out: &mut Write, ctx: &SessionInfo) -> Result<IsNull> {
35-
if !<Slice<'a, T> as ToSql>::accepts(ty) {
36-
return Err(Error::WrongType(ty.clone()));
37-
}
38-
self.to_sql(ty, out, ctx)
39-
}
40-
4132
fn to_sql<W: Write + ?Sized>(&self,
4233
ty: &Type,
4334
mut w: &mut W,
@@ -76,4 +67,6 @@ impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
7667
_ => false,
7768
}
7869
}
70+
71+
to_sql_checked!();
7972
}

0 commit comments

Comments
 (0)