refactor(types): simplify <&str as ToSql>::to_sql

This commit is contained in:
Basti Ortiz 2023-04-07 21:39:37 +08:00
parent 7dd6813fa8
commit a67fe643a9
No known key found for this signature in database
GPG Key ID: 1402D5CB17F48E1B

View File

@ -1012,10 +1012,10 @@ impl ToSql for Vec<u8> {
impl<'a> ToSql for &'a str {
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
match *ty {
ref ty if ty.name() == "ltree" => types::ltree_to_sql(self, w),
ref ty if ty.name() == "lquery" => types::lquery_to_sql(self, w),
ref ty if ty.name() == "ltxtquery" => types::ltxtquery_to_sql(self, w),
match ty.name() {
"ltree" => types::ltree_to_sql(self, w),
"lquery" => types::lquery_to_sql(self, w),
"ltxtquery" => types::ltxtquery_to_sql(self, w),
_ => types::text_to_sql(self, w),
}
Ok(IsNull::No)