@@ -1012,28 +1012,20 @@ impl ToSql for Vec<u8> {
1012
1012
1013
1013
impl < ' a > ToSql for & ' a str {
1014
1014
fn to_sql ( & self , ty : & Type , w : & mut BytesMut ) -> Result < IsNull , Box < dyn Error + Sync + Send > > {
1015
- match * ty {
1016
- ref ty if ty . name ( ) == "ltree" => types:: ltree_to_sql ( self , w) ,
1017
- ref ty if ty . name ( ) == "lquery" => types:: lquery_to_sql ( self , w) ,
1018
- ref ty if ty . name ( ) == "ltxtquery" => types:: ltxtquery_to_sql ( self , w) ,
1015
+ match ty . name ( ) {
1016
+ "ltree" => types:: ltree_to_sql ( self , w) ,
1017
+ "lquery" => types:: lquery_to_sql ( self , w) ,
1018
+ "ltxtquery" => types:: ltxtquery_to_sql ( self , w) ,
1019
1019
_ => types:: text_to_sql ( self , w) ,
1020
1020
}
1021
1021
Ok ( IsNull :: No )
1022
1022
}
1023
1023
1024
1024
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" )
1037
1029
}
1038
1030
1039
1031
to_sql_checked ! ( ) ;
0 commit comments