Skip to content

Commit a3725a9

Browse files
committed
Move type checking to the right place in Slice impl
1 parent 15034f9 commit a3725a9

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/types/slice.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
4141
&Kind::Array(ref member) => member,
4242
_ => panic!("expected array type"),
4343
};
44-
if !<T as ToSql>::accepts(&member_type) {
45-
return Err(Error::WrongType(ty.clone()));
46-
}
4744

4845
try!(w.write_i32::<BigEndian>(1)); // number of dimensions
4946
try!(w.write_i32::<BigEndian>(1)); // has nulls
@@ -69,7 +66,7 @@ impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
6966

7067
fn accepts(ty: &Type) -> bool {
7168
match ty.kind() {
72-
&Kind::Array(..) => true,
69+
&Kind::Array(ref member) => <T as ToSql>::accepts(member),
7370
_ => false,
7471
}
7572
}

0 commit comments

Comments
 (0)