@@ -619,24 +619,24 @@ impl<'a> FromSql<'a> for Box<str> {
619
619
impl < ' a > FromSql < ' a > for & ' a str {
620
620
fn from_sql ( ty : & Type , raw : & ' a [ u8 ] ) -> Result < & ' a str , Box < dyn Error + Sync + Send > > {
621
621
match * ty {
622
- ref ty if (
623
- ty. name ( ) == "ltree" ||
624
- ty. name ( ) == "lquery" ||
625
- ty. name ( ) == "ltxtquery"
626
- ) => types:: ltree_from_sql ( raw) ,
627
- _ => types:: text_from_sql ( raw)
622
+ ref ty if ty. name ( ) == "ltree" => types:: ltree_from_sql ( raw) ,
623
+ ref ty if ty. name ( ) == "lquery" => types:: lquery_from_sql ( raw) ,
624
+ ref ty if ty. name ( ) == "ltxtquery" => types:: ltxtquery_from_sql ( raw) ,
625
+ _ => types:: text_from_sql ( raw) ,
628
626
}
629
627
}
630
628
631
629
fn accepts ( ty : & Type ) -> bool {
632
630
match * ty {
633
631
Type :: VARCHAR | Type :: TEXT | Type :: BPCHAR | Type :: NAME | Type :: UNKNOWN => true ,
634
- ref ty if (
635
- ty. name ( ) == "citext" ||
636
- ty. name ( ) == "ltree" ||
637
- ty. name ( ) == "lquery" ||
638
- ty. name ( ) == "ltxtquery"
639
- ) => true ,
632
+ ref ty
633
+ if ( ty. name ( ) == "citext"
634
+ || ty. name ( ) == "ltree"
635
+ || ty. name ( ) == "lquery"
636
+ || ty. name ( ) == "ltxtquery" ) =>
637
+ {
638
+ true
639
+ }
640
640
_ => false ,
641
641
}
642
642
}
@@ -939,26 +939,26 @@ impl ToSql for Vec<u8> {
939
939
940
940
impl < ' a > ToSql for & ' a str {
941
941
fn to_sql ( & self , ty : & Type , w : & mut BytesMut ) -> Result < IsNull , Box < dyn Error + Sync + Send > > {
942
- match ty {
943
- ref ty if (
944
- ty. name ( ) == "ltree" ||
945
- ty. name ( ) == "lquery" ||
946
- ty. name ( ) == "ltxtquery"
947
- ) => types:: ltree_to_sql ( * self , w) ,
948
- _ => types:: text_to_sql ( * self , w)
942
+ match * ty {
943
+ ref ty if ty. name ( ) == "ltree" => types:: ltree_to_sql ( * self , w) ,
944
+ ref ty if ty. name ( ) == "lquery" => types:: lquery_to_sql ( * self , w) ,
945
+ ref ty if ty. name ( ) == "ltxtquery" => types:: ltxtquery_to_sql ( * self , w) ,
946
+ _ => types:: text_to_sql ( * self , w) ,
949
947
}
950
948
Ok ( IsNull :: No )
951
949
}
952
950
953
951
fn accepts ( ty : & Type ) -> bool {
954
952
match * ty {
955
953
Type :: VARCHAR | Type :: TEXT | Type :: BPCHAR | Type :: NAME | Type :: UNKNOWN => true ,
956
- ref ty if (
957
- ty. name ( ) == "citext" ||
958
- ty. name ( ) == "ltree" ||
959
- ty. name ( ) == "lquery" ||
960
- ty. name ( ) == "ltxtquery"
961
- ) => true ,
954
+ ref ty
955
+ if ( ty. name ( ) == "citext"
956
+ || ty. name ( ) == "ltree"
957
+ || ty. name ( ) == "lquery"
958
+ || ty. name ( ) == "ltxtquery" ) =>
959
+ {
960
+ true
961
+ }
962
962
_ => false ,
963
963
}
964
964
}
0 commit comments