Skip to content

Commit 16e4c9a

Browse files
committed
poc
1 parent dcb58b0 commit 16e4c9a

File tree

1 file changed

+9
-15
lines changed
  • sqlx-macros-core/src/derives

1 file changed

+9
-15
lines changed

sqlx-macros-core/src/derives/type.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn expand_derive_has_sql_type_transparent(
7777
.push(parse_quote!(#ty: ::sqlx::postgres::PgHasArrayType));
7878
let (array_impl_generics, _, array_where_clause) = array_generics.split_for_impl();
7979

80-
let mut tokens = quote!(
80+
return Ok(quote!(
8181
#[automatically_derived]
8282
impl #impl_generics ::sqlx::Type< DB > for #ident #ty_generics #where_clause {
8383
fn type_info() -> DB::TypeInfo {
@@ -88,21 +88,15 @@ fn expand_derive_has_sql_type_transparent(
8888
<#ty as ::sqlx::Type<DB>>::compatible(ty)
8989
}
9090
}
91-
);
92-
93-
if cfg!(feature = "postgres") {
94-
tokens.extend(quote!(
95-
#[automatically_derived]
96-
impl #array_impl_generics ::sqlx::postgres::PgHasArrayType for #ident #ty_generics
97-
#array_where_clause {
98-
fn array_type_info() -> ::sqlx::postgres::PgTypeInfo {
99-
<#ty as ::sqlx::postgres::PgHasArrayType>::array_type_info()
100-
}
91+
#[automatically_derived]
92+
#[cfg(feature = "postgres")]
93+
impl #array_impl_generics ::sqlx::postgres::PgHasArrayType for #ident #ty_generics
94+
#array_where_clause {
95+
fn array_type_info() -> ::sqlx::postgres::PgTypeInfo {
96+
<#ty as ::sqlx::postgres::PgHasArrayType>::array_type_info()
10197
}
102-
));
103-
}
104-
105-
return Ok(tokens);
98+
}
99+
));
106100
}
107101

108102
let mut tts = TokenStream::new();

0 commit comments

Comments
 (0)