refactor(types): prefer matches! macro for readability

This commit is contained in:
Basti Ortiz 2023-04-07 21:43:25 +08:00
parent a67fe643a9
commit 98abdf9fa2
No known key found for this signature in database
GPG Key ID: 1402D5CB17F48E1B

View File

@ -1022,18 +1022,10 @@ impl<'a> ToSql for &'a str {
}
fn accepts(ty: &Type) -> bool {
match *ty {
Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN => true,
ref ty
if (ty.name() == "citext"
|| ty.name() == "ltree"
|| ty.name() == "lquery"
|| ty.name() == "ltxtquery") =>
{
true
}
_ => false,
}
matches!(
*ty,
Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN
) || matches!(ty.name(), "citext" | "ltree" | "lquery" | "ltxtquery")
}
to_sql_checked!();