Fix FromQueryResult when Result is redefined

Macros should only ever use absolute import paths.
Shorthands can clash (as they have in my case).
This commit is contained in:
Tom Hacohen 2022-01-30 13:00:02 +02:00 committed by GitHub
parent 76c0d7fff5
commit 30e7625300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ pub fn expand_derive_from_query_result(ident: Ident, data: Data) -> syn::Result<
Ok(quote!( Ok(quote!(
#[automatically_derived] #[automatically_derived]
impl sea_orm::FromQueryResult for #ident { impl sea_orm::FromQueryResult for #ident {
fn from_query_result(row: &sea_orm::QueryResult, pre: &str) -> Result<Self, sea_orm::DbErr> { fn from_query_result(row: &sea_orm::QueryResult, pre: &str) -> std::result::Result<Self, sea_orm::DbErr> {
Ok(Self { Ok(Self {
#(#field: row.try_get(pre, #name)?),* #(#field: row.try_get(pre, #name)?),*
}) })