Skip to content

Commit 98abdf9

Browse files
committed
refactor(types): prefer matches! macro for readability
1 parent a67fe64 commit 98abdf9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

postgres-types/src/lib.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -1022,18 +1022,10 @@ impl<'a> ToSql for &'a str {
10221022
}
10231023

10241024
fn accepts(ty: &Type) -> bool {
1025-
match *ty {
1026-
Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN => true,
1027-
ref ty
1028-
if (ty.name() == "citext"
1029-
|| ty.name() == "ltree"
1030-
|| ty.name() == "lquery"
1031-
|| ty.name() == "ltxtquery") =>
1032-
{
1033-
true
1034-
}
1035-
_ => false,
1036-
}
1025+
matches!(
1026+
*ty,
1027+
Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN
1028+
) || matches!(ty.name(), "citext" | "ltree" | "lquery" | "ltxtquery")
10371029
}
10381030

10391031
to_sql_checked!();

0 commit comments

Comments
 (0)