Skip to content

Commit e07c66b

Browse files
jbcdensgrif
authored andcommitted
Remove ToSql impl for Cow (diesel-rs#1499)
ToSql impl for Cow doesn't require T::Owned = ToSql
1 parent 36e7cc3 commit e07c66b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

diesel/src/type_impls/primitives.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,15 @@ impl<DB: Backend> ToSql<sql_types::Binary, DB> for [u8] {
170170
}
171171

172172
use std::borrow::{Cow, ToOwned};
173+
use std::fmt;
173174
impl<'a, T: ?Sized, ST, DB> ToSql<ST, DB> for Cow<'a, T>
174175
where
175176
T: 'a + ToOwned + ToSql<ST, DB>,
176177
DB: Backend,
177-
T::Owned: ToSql<ST, DB>,
178+
Self: fmt::Debug,
178179
{
179180
fn to_sql<W: Write>(&self, out: &mut Output<W, DB>) -> serialize::Result {
180-
match *self {
181-
Cow::Borrowed(t) => t.to_sql(out),
182-
Cow::Owned(ref t) => t.to_sql(out),
183-
}
181+
ToSql::<ST, DB>::to_sql(&**self, out)
184182
}
185183
}
186184

0 commit comments

Comments
 (0)