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 { fn accepts(ty: &Type) -> bool {
match *ty { matches!(
Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN => true, *ty,
ref ty Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN
if (ty.name() == "citext" ) || matches!(ty.name(), "citext" | "ltree" | "lquery" | "ltxtquery")
|| ty.name() == "ltree"
|| ty.name() == "lquery"
|| ty.name() == "ltxtquery") =>
{
true
}
_ => false,
}
} }
to_sql_checked!(); to_sql_checked!();