refactor(types): prefer matches!
macro for readability
This commit is contained in:
parent
a67fe643a9
commit
98abdf9fa2
@ -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!();
|
||||||
|
Loading…
Reference in New Issue
Block a user